From e4a11b20736efdd6b46c8476bc666ee33b517a6e Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Sun, 23 Jul 2017 17:49:38 +0200 Subject: activation-checks: add NIX_PATH check for nixpkgs --- modules/system/activation-checks.nix | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'modules/system') diff --git a/modules/system/activation-checks.nix b/modules/system/activation-checks.nix index ccff46c..d8af055 100644 --- a/modules/system/activation-checks.nix +++ b/modules/system/activation-checks.nix @@ -20,20 +20,21 @@ let nixPath = optionalString true '' darwinConfig=$(NIX_PATH=${concatStringsSep ":" config.nix.nixPath} nix-instantiate --eval -E '') - if [ -z $darwinPath ]; then + if ! test -e "$darwinConfig"; then echo "error: Changed but target does not exist, aborting activation" >&2 echo "Move you configuration.nix or set NIX_PATH:" >&2 echo >&2 - echo " nix.nixPath = [ \"darwi-config=${builtins.toString }\" ];" >&2 + echo " nix.nixPath = [ \"darwin-config=${builtins.toString }\" ];" >&2 echo >&2 exit 2 fi darwinPath=$(NIX_PATH=${concatStringsSep ":" config.nix.nixPath} nix-instantiate --eval -E '') - if [ -z $darwinPath ]; then + if ! test -e "$darwinPath"; then echo "error: Changed but target does not exist, aborting activation" >&2 echo "Add the darwin repo as a channel or set NIX_PATH:" >&2 echo "$ sudo nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin" >&2 + echo "$ sudo nix-channel --update" >&2 echo >&2 echo "or set" >&2 echo >&2 @@ -41,6 +42,20 @@ let echo >&2 exit 2 fi + + nixpkgsPath=$(NIX_PATH=${concatStringsSep ":" config.nix.nixPath} nix-instantiate --eval -E '') + if ! test -e "$nixpkgsPath"; then + echo "error: Changed but target does not exist, aborting activation" >&2 + echo "Add a nixpkgs channel or set NIX_PATH:" >&2 + echo "$ sudo nix-channel --add http://nixos.org/channels/nixpkgs-unstable nixpkgs" >&2 + echo "$ sudo nix-channel --update" >&2 + echo >&2 + echo "or set" >&2 + echo >&2 + echo " nix.nixPath = [ \"nixpkgs=${builtins.toString }\" ];" >&2 + echo >&2 + exit 2 + fi ''; in -- cgit v1.2.3