#nixos #editor #nix #nix-editor

bin+lib nix-editor

Some functions to modify NixOS configuration files

12 releases

0.3.0 Feb 3, 2023
0.3.0-beta.1 Oct 6, 2022
0.2.12 Jul 18, 2022
0.2.11 Jun 23, 2022
0.2.6 Mar 27, 2022

#7 in #nixos

Download history 71/week @ 2024-12-22 71/week @ 2024-12-29 111/week @ 2025-01-05 102/week @ 2025-01-12 125/week @ 2025-01-19 98/week @ 2025-01-26 92/week @ 2025-02-02 139/week @ 2025-02-09 107/week @ 2025-02-16 86/week @ 2025-02-23 130/week @ 2025-03-02 96/week @ 2025-03-09 117/week @ 2025-03-16 83/week @ 2025-03-23 72/week @ 2025-03-30 57/week @ 2025-04-06

345 downloads per month
Used in 10 crates (6 directly)

MIT license

105KB
1.5K SLoC

Nix Editor

crates.io Coverage Status Built with Nix License: MIT

A command line utility for modifying NixOS configuration values.

Installation

nix-env

git clone https://github.com/vlinkz/nix-editor
nix-env -f nix-editor -i nix-editor

nix profile

nix profile install github:vlinkz/nix-editor

Run with Nix Flakes

nix run github:vlinkz/nix-editor -- --help
Usage: nix-editor [OPTIONS] <FILE> <ATTRIBUTE>

Arguments:
  <FILE>       Configuration file to read
  <ATTRIBUTE>  Nix configuration option arribute

Options:
  -v, --val <VAL>        Value to write
  -a, --arr <ARR>        Element to add
  -d, --deref            Dereference the value of the attribute
  -i, --inplace          Edit the file in-place
  -o, --output <OUTPUT>  Output file for modified config or read value
  -r, --raw              Prints console output without newlines or trimmed output
  -f, --format           Formats output using nixpkgs-fmt. Helps when writing new values
  -h, --help             Print help
  -V, --version          Print version

Dependencies

~8–17MB
~217K SLoC