1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-31 04:04:45 +00:00

nix: check nix.useDaemon value

This case will cause problems when existing files in /etc are replaced
instead of skipped with a warning, potentially breaking the nix install
in the process.
This commit is contained in:
Daiderd Jordan 2019-07-01 21:34:37 +02:00
parent 8c2b25e60d
commit 4bffc92b7a
No known key found for this signature in database
GPG key ID: D02435D05B810C96

View file

@ -47,6 +47,21 @@ let
fi
'';
singleUser = ''
if grep -q 'build-users-group =' /etc/nix/nix.conf; then
echo "error: The daemon is not enabled but this is a multi-user install, aborting activation" >&2
echo "Enable the nix-daemon service:" >&2
echo >&2
echo " services.nix-daemon.enable = true;" >&2
echo >&2
echo "or set" >&2
echo >&2
echo " nix.useDaemon = true;" >&2
echo >&2
exit 2
fi
'';
nixChannels = ''
channelsLink=$(readlink "$HOME/.nix-defexpr/channels") || true
case "$channelsLink" in
@ -170,6 +185,7 @@ in
darwinChanges
runLink
(mkIf config.nix.useDaemon buildUsers)
(mkIf (!config.nix.useDaemon) singleUser)
nixStore
(mkIf (config.nix.gc.automatic && config.nix.gc.user == null) nixGarbageCollector)
nixChannels