mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-15 17:51:01 +00:00
activation-checks: add NIX_PATH check for darwin
This commit is contained in:
parent
8016f1e2fd
commit
05d8495ed8
1 changed files with 24 additions and 1 deletions
|
@ -6,7 +6,29 @@ let
|
||||||
buildUsers = optionalString config.services.nix-daemon.enable ''
|
buildUsers = optionalString config.services.nix-daemon.enable ''
|
||||||
buildUser=$(dscl . -read /Groups/nixbld GroupMembership 2>&1 | awk '/^GroupMembership: / {print $2}')
|
buildUser=$(dscl . -read /Groups/nixbld GroupMembership 2>&1 | awk '/^GroupMembership: / {print $2}')
|
||||||
if [ -z $buildUser ]; then
|
if [ -z $buildUser ]; then
|
||||||
echo "Using the nix-daemon requires build users, aborting activation" >&2
|
echo "[1;31merror: Using the nix-daemon requires build users, aborting activation[0m" >&2
|
||||||
|
echo "Create the build users or disable the daemon:" >&2
|
||||||
|
echo "$ ./bootstrap -u" >&2
|
||||||
|
echo >&2
|
||||||
|
echo "or set" >&2
|
||||||
|
echo >&2
|
||||||
|
echo " services.nix-daemon.enable = false;" >&2
|
||||||
|
echo >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
|
nixPath = optionalString true ''
|
||||||
|
darwinPath=$(NIX_PATH=${concatStringsSep ":" config.nix.nixPath} nix-instantiate --eval -E '<darwin>')
|
||||||
|
if [ -z $darwinPath ]; then
|
||||||
|
echo "[1;31merror: Changed <darwin> but target does not exist, aborting activation[0m" >&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 >&2
|
||||||
|
echo "or set" >&2
|
||||||
|
echo >&2
|
||||||
|
echo " nix.nixPath = [ \"darwin=${builtins.toString <darwin>}\" ];" >&2
|
||||||
|
echo >&2
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
@ -21,6 +43,7 @@ in
|
||||||
system.activationScripts.checks.text = ''
|
system.activationScripts.checks.text = ''
|
||||||
set +e
|
set +e
|
||||||
${buildUsers}
|
${buildUsers}
|
||||||
|
${nixPath}
|
||||||
set -e
|
set -e
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue