diff options
author | Ryan Mulligan <ryan@ryantm.com> | 2020-10-10 08:03:11 -0700 |
---|---|---|
committer | nuxeh <drq.11235@gmail.com> | 2020-10-11 11:15:56 +0100 |
commit | 4a3fe8d306bffc348c3a61ca2c9247dace1fc819 (patch) | |
tree | 731856aa1573354e91abfb6baeb61142371e2b6b /nixos | |
parent | c7683646526e3b5630b27c5e157bdca088500262 (diff) |
nixos/domoticz: use DynamicUser and StateDirectory
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/misc/domoticz.nix | 44 |
1 files changed, 3 insertions, 41 deletions
diff --git a/nixos/modules/services/misc/domoticz.nix b/nixos/modules/services/misc/domoticz.nix index 42b4218aa094..b1353d484048 100644 --- a/nixos/modules/services/misc/domoticz.nix +++ b/nixos/modules/services/misc/domoticz.nix @@ -14,31 +14,6 @@ in { services.domoticz = { enable = mkEnableOption pkgDesc; - user = mkOption { - type = types.str; - default = "domoticz"; - description = "domoticz user"; - }; - - group = mkOption { - type = types.str; - default = "domoticz"; - description = "domoticz group"; - }; - - extraGroups = mkOption { - type = types.listOf types.str; - default = [ ]; - description = "Extra groups to add to domoticz user"; - }; - - stateDir = mkOption { - type = types.path; - default = "/var/lib/domoticz/"; - description = "The state directory for domoticz"; - example = "/home/bob/.domoticz/"; - }; - bind = mkOption { type = types.str; default = "0.0.0.0"; @@ -57,29 +32,16 @@ in { config = mkIf cfg.enable { - users.users."domoticz" = { - name = cfg.user; - group = cfg.group; - extraGroups = cfg.extraGroups; - home = cfg.stateDir; - createHome = true; - description = pkgDesc; - }; - - users.groups."domoticz" = { - name = cfg.group; - }; - systemd.services."domoticz" = { description = pkgDesc; wantedBy = [ "multi-user.target" ]; after = [ "network-online.target" ]; serviceConfig = { - User = cfg.user; - Group = cfg.group; + DynamicUser = true; + StateDirectory = "domoticz"; Restart = "always"; ExecStart = '' - ${pkgs.domoticz}/bin/domoticz -noupdates -www ${toString cfg.port} -wwwbind ${cfg.bind} -sslwww 0 -userdata ${cfg.stateDir} -approot ${pkgs.domoticz}/share/domoticz/ -pidfile /var/run/domoticz.pid + ${pkgs.domoticz}/bin/domoticz -noupdates -www ${toString cfg.port} -wwwbind ${cfg.bind} -sslwww 0 -userdata /var/lib/domoticz -approot ${pkgs.domoticz}/share/domoticz/ -pidfile /var/run/domoticz.pid ''; }; }; |