From a25d345a7e69170a780fdf99b65a4c40f46db942 Mon Sep 17 00:00:00 2001 From: zimbatm Date: Fri, 3 Aug 2018 15:08:21 +0100 Subject: [PATCH] darwin-rebuild edit As a user I don't want to remember where the configuration exists. This adds a command that will point the $EDITOR to the file. darwin-rebuild edit --- pkgs/nix-tools/darwin-rebuild.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/nix-tools/darwin-rebuild.sh b/pkgs/nix-tools/darwin-rebuild.sh index a54c1c21d..5b87569bf 100644 --- a/pkgs/nix-tools/darwin-rebuild.sh +++ b/pkgs/nix-tools/darwin-rebuild.sh @@ -5,7 +5,7 @@ export PATH=@path@:$PATH showSyntax() { - echo "darwin-rebuild [--help] {build | switch | check | changelog}" >&2 + echo "darwin-rebuild [--help] {edit | build | switch | check | changelog}" >&2 echo " [--list-generations] [{--profile-name | -p} name] [--rollback]" >&2 echo " [{--switch-generation | -G} generation] [--verbose...] [-v...]" >&2 echo " [-Q] [{--max-jobs | -j} number] [--cores number] [--dry-run]" >&1 @@ -28,7 +28,7 @@ while [ "$#" -gt 0 ]; do --help) showSyntax ;; - switch|build|changelog|check) + edit|switch|build|changelog|check) action="$i" ;; --show-trace|--no-build-hook|--dry-run|--keep-going|-k|--keep-failed|-K|--verbose|-v|-vv|-vvv|-vvvv|-vvvvv|--fallback|-Q) @@ -146,3 +146,8 @@ if [ "$action" = check ]; then export checkActivation=1 $systemConfig/activate-user fi + +if [ "$action" = edit ]; then + darwinConfig=$(nix-instantiate --eval --strict -E "") + ${EDITOR:-nano} "$darwinConfig" +fi