summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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