nixos-rebuild: add edit command (#56241)
This commit is contained in:
parent
98d8bf4bea
commit
50fec3dcd2
@ -29,7 +29,7 @@ while [ "$#" -gt 0 ]; do
|
|||||||
--help)
|
--help)
|
||||||
showSyntax
|
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
|
if [ "$i" = dry-run ]; then i=dry-build; fi
|
||||||
action="$i"
|
action="$i"
|
||||||
;;
|
;;
|
||||||
@ -227,6 +227,13 @@ if [ -z "$_NIXOS_REBUILD_REEXEC" -a -n "$canRun" -a -z "$fast" ]; then
|
|||||||
fi
|
fi
|
||||||
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)
|
tmpDir=$(mktemp -t -d nixos-rebuild.XXXXXX)
|
||||||
SSHOPTS="$NIX_SSHOPTS -o ControlMaster=auto -o ControlPath=$tmpDir/ssh-%n -o ControlPersist=60"
|
SSHOPTS="$NIX_SSHOPTS -o ControlMaster=auto -o ControlPath=$tmpDir/ssh-%n -o ControlPersist=60"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user