summary refs log tree commit diff stats
path: root/system/services/nix
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-07-03 21:32:48 +0200
committerSoispha <soispha@vhack.eu>2023-07-04 08:10:27 +0200
commit39abbf77467e3dcc09aef23c9e446e3a938ec1d9 (patch)
tree261282ba0ac8f4b8207fb146a753587a33b6a6b7 /system/services/nix
parentFix(system/services/nix-sync): Rename units to nix-sync-<domain> (diff)
downloadnixos-server-39abbf77467e3dcc09aef23c9e446e3a938ec1d9.tar.gz
nixos-server-39abbf77467e3dcc09aef23c9e446e3a938ec1d9.zip
Fix(system/services/nix-sync): Generate user and group if set to default
Diffstat (limited to '')
-rw-r--r--system/services/nix-sync/default.nix17
1 files changed, 17 insertions, 0 deletions
diff --git a/system/services/nix-sync/default.nix b/system/services/nix-sync/default.nix
index b4859a1..d0ca114 100644
--- a/system/services/nix-sync/default.nix
+++ b/system/services/nix-sync/default.nix
@@ -188,6 +188,23 @@ in {
 
   config = lib.mkIf cfg.enable {
     systemd.services = services;
+    users.users =
+      if cfg.user == "nix-sync"
+      then {
+        nix-sync = {
+          group = "${cfg.group}";
+          isSystemUser = true;
+        };
+      }
+      else lib.warnIf (cfg.user != "nix-sync") "The user (${cfg.user}) is not \"nix-sync\", thus you are responible for generating it.";
+    users.groups =
+      if cfg.group == "nix-sync"
+      then {
+        nix-sync = {
+          members = ["${cfg.user}"];
+        };
+      }
+      else lib.warnIf (cfg.group != "nix-sync") "The group (${cfg.group}) is not \"nix-sync\", thus you are responible for generating it.";
   };
 }
 # vim: ts=2