summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorMichael Hoang <Enzime@users.noreply.github.com>2024-11-16 14:42:50 +0000
committerGitHub <noreply@github.com>2024-11-16 14:42:50 +0000
commit2bcef10f4319f34ddebadb5f37eaa81ca2510730 (patch)
tree64928f05e87848dddf2d6530a5a470ec19f49f65 /modules/system
parentf86f158efd4bab8dce3e207e4621f1df3a760b7a (diff)
parentec5fce6061c26095f6de3a9cb9398171aa3b8c86 (diff)
Merge pull request #1164 from Enzime/push-yyusnrnkwkxu
nix-daemon: enable by default
Diffstat (limited to 'modules/system')
-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)