mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
checks: check single user installs don't have the nix-daemon
enabled
Remove suggestion to set `nix.useDaemon` as it came without an explanation of how the `nix-daemon` would be unmanaged and would most likely lead to most users running an old version of Nix as the daemon.
This commit is contained in:
parent
5d1b7ac696
commit
6d794390fa
1 changed files with 21 additions and 13 deletions
|
@ -129,18 +129,26 @@ let
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
singleUser = ''
|
nixDaemon = if config.nix.useDaemon then ''
|
||||||
if grep -q 'build-users-group =' /etc/nix/nix.conf; then
|
if ! dscl . -read /Groups/nixbld PrimaryGroupID &> /dev/null; then
|
||||||
echo "[1;31merror: The daemon is not enabled but this is a multi-user install, aborting activation[0m" >&2
|
printf >&2 '[1;31merror: The daemon should not be enabled for single-user installs, aborting activation[0m\n'
|
||||||
echo "Enable the nix-daemon service:" >&2
|
printf >&2 'Disable the nix-daemon service:\n'
|
||||||
echo >&2
|
printf >&2 '\n'
|
||||||
echo " services.nix-daemon.enable = true;" >&2
|
printf >&2 ' services.nix-daemon.enable = false;\n'
|
||||||
echo >&2
|
printf >&2 '\n'
|
||||||
echo "or set" >&2
|
# shellcheck disable=SC2016
|
||||||
echo >&2
|
printf >&2 'and remove `nix.useDaemon` from your configuration if it is present.\n'
|
||||||
echo " nix.useDaemon = true;" >&2
|
printf >&2 '\n'
|
||||||
echo >&2
|
exit 2
|
||||||
exit 2
|
fi
|
||||||
|
'' else ''
|
||||||
|
if dscl . -read /Groups/nixbld PrimaryGroupID &> /dev/null; then
|
||||||
|
printf >&2 '[1;31merror: The daemon should be enabled for multi-user installs, aborting activation[0m\n'
|
||||||
|
printf >&2 'Enable the nix-daemon service:\n'
|
||||||
|
printf >&2 '\n'
|
||||||
|
printf >&2 ' services.nix-daemon.enable = true;\n'
|
||||||
|
printf >&2 '\n'
|
||||||
|
exit 2
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -337,7 +345,7 @@ in
|
||||||
(mkIf cfg.verifyBuildUsers buildUsers)
|
(mkIf cfg.verifyBuildUsers buildUsers)
|
||||||
(mkIf cfg.verifyBuildUsers preSequoiaBuildUsers)
|
(mkIf cfg.verifyBuildUsers preSequoiaBuildUsers)
|
||||||
(mkIf config.nix.configureBuildUsers buildGroupID)
|
(mkIf config.nix.configureBuildUsers buildGroupID)
|
||||||
(mkIf (!config.nix.useDaemon) singleUser)
|
nixDaemon
|
||||||
nixStore
|
nixStore
|
||||||
(mkIf (config.nix.gc.automatic && config.nix.gc.user == null) nixGarbageCollector)
|
(mkIf (config.nix.gc.automatic && config.nix.gc.user == null) nixGarbageCollector)
|
||||||
(mkIf (config.nix.optimise.automatic && config.nix.optimise.user == null) nixStoreOptimiser)
|
(mkIf (config.nix.optimise.automatic && config.nix.optimise.user == null) nixStoreOptimiser)
|
||||||
|
|
Loading…
Reference in a new issue