1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-04-15 00:36:44 +00:00

activation-checks: add NIX_PATH check for nixpkgs

This commit is contained in:
Daiderd Jordan 2017-07-23 17:49:38 +02:00
parent 345d9ffa0e
commit e4a11b2073
No known key found for this signature in database
GPG key ID: D02435D05B810C96

View file

@ -20,20 +20,21 @@ let
nixPath = optionalString true ''
darwinConfig=$(NIX_PATH=${concatStringsSep ":" config.nix.nixPath} nix-instantiate --eval -E '<darwin-config>')
if [ -z $darwinPath ]; then
if ! test -e "$darwinConfig"; then
echo "error: Changed <darwin-config> 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 <darwin-config>}\" ];" >&2
echo " nix.nixPath = [ \"darwin-config=${builtins.toString <darwin-config>}\" ];" >&2
echo >&2
exit 2
fi
darwinPath=$(NIX_PATH=${concatStringsSep ":" config.nix.nixPath} nix-instantiate --eval -E '<darwin>')
if [ -z $darwinPath ]; then
if ! test -e "$darwinPath"; then
echo "error: Changed <darwin> 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 '<nixpkgs>')
if ! test -e "$nixpkgsPath"; then
echo "error: Changed <nixpkgs> 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 <nixpkgs>}\" ];" >&2
echo >&2
exit 2
fi
'';
in