diff options
author | Daiderd Jordan <daiderd@gmail.com> | 2019-02-25 00:59:35 +0100 |
---|---|---|
committer | xeji <36407913+xeji@users.noreply.github.com> | 2019-02-25 00:59:35 +0100 |
commit | 50fec3dcd26dd1d187904e8a8a2ed7d181449f36 (patch) | |
tree | a80dc05f9913cc80d1c82d399a57ca15fda92944 /nixos | |
parent | 98d8bf4beabffecef3159a1aac90dbfca3fe2653 (diff) |
nixos-rebuild: add edit command (#56241)
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/installer/tools/nixos-rebuild.sh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nixos/modules/installer/tools/nixos-rebuild.sh b/nixos/modules/installer/tools/nixos-rebuild.sh index 361c2e49e05c1..27e5b5d8c7044 100644 --- a/nixos/modules/installer/tools/nixos-rebuild.sh +++ b/nixos/modules/installer/tools/nixos-rebuild.sh @@ -29,7 +29,7 @@ while [ "$#" -gt 0 ]; do --help) showSyntax ;; - switch|boot|test|build|dry-build|dry-run|dry-activate|build-vm|build-vm-with-bootloader) + switch|boot|test|build|edit|dry-build|dry-run|dry-activate|build-vm|build-vm-with-bootloader) if [ "$i" = dry-run ]; then i=dry-build; fi action="$i" ;; @@ -227,6 +227,13 @@ if [ -z "$_NIXOS_REBUILD_REEXEC" -a -n "$canRun" -a -z "$fast" ]; then fi fi +# Find configuration.nix and open editor instead of building. +if [ "$action" = edit ]; then + NIXOS_CONFIG=${NIXOS_CONFIG:-$(nix-instantiate --find-file nixos-config)} + exec "${EDITOR:-nano}" "$NIXOS_CONFIG" + exit 1 +fi + tmpDir=$(mktemp -t -d nixos-rebuild.XXXXXX) SSHOPTS="$NIX_SSHOPTS -o ControlMaster=auto -o ControlPath=$tmpDir/ssh-%n -o ControlPersist=60" |