summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/system/checks.nix34
1 files changed, 21 insertions, 13 deletions
diff --git a/modules/system/checks.nix b/modules/system/checks.nix
index ab6ea19..949a28e 100644
--- a/modules/system/checks.nix
+++ b/modules/system/checks.nix
@@ -129,18 +129,26 @@ 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
+ nixDaemon = if config.nix.useDaemon then ''
+ if ! dscl . -read /Groups/nixbld PrimaryGroupID &> /dev/null; then
+ printf >&2 'error: The daemon should not be enabled for single-user installs, aborting activation\n'
+ printf >&2 'Disable the nix-daemon service:\n'
+ printf >&2 '\n'
+ printf >&2 ' services.nix-daemon.enable = false;\n'
+ printf >&2 '\n'
+ # shellcheck disable=SC2016
+ printf >&2 'and remove `nix.useDaemon` from your configuration if it is present.\n'
+ printf >&2 '\n'
+ exit 2
+ fi
+ '' else ''
+ if dscl . -read /Groups/nixbld PrimaryGroupID &> /dev/null; then
+ printf >&2 'error: The daemon should be enabled for multi-user installs, aborting activation\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
'';
@@ -337,7 +345,7 @@ in
(mkIf cfg.verifyBuildUsers buildUsers)
(mkIf cfg.verifyBuildUsers preSequoiaBuildUsers)
(mkIf config.nix.configureBuildUsers buildGroupID)
- (mkIf (!config.nix.useDaemon) singleUser)
+ nixDaemon
nixStore
(mkIf (config.nix.gc.automatic && config.nix.gc.user == null) nixGarbageCollector)
(mkIf (config.nix.optimise.automatic && config.nix.optimise.user == null) nixStoreOptimiser)