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:
parent
8c2b25e60d
commit
4bffc92b7a
1 changed files with 16 additions and 0 deletions
|
@ -47,6 +47,21 @@ let
|
|||
fi
|
||||
'';
|
||||
|
||||
singleUser = ''
|
||||
if grep -q 'build-users-group =' /etc/nix/nix.conf; then
|
||||
echo "[1;31merror: The daemon is not enabled but this is a multi-user install, aborting activation[0m" >&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
|
||||
|
|
Loading…
Add table
Reference in a new issue