diff --git a/nix/module.nix b/nix/module.nix index 9c4c19ef72266c9f78cc82e054320650e0f6e95a..8854312edf648e59770f86544af9c79d12cc5d43 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -71,7 +71,7 @@ default = { }; description = "Attribute set of tailproxy instances"; }; }; - config = lib.mkIf (cfg != { }) { + config = lib.mkIf (cfg.instances != { }) { systemd.services = lib.mapAttrs' ( name: instanceCfg: lib.nameValuePair "tailproxy-${name}" { @@ -97,8 +97,8 @@ User = instanceCfg.user; Restart = "on-failure"; }; } -let pkg = pkgs.callPackage ./pkg.nix { inherit pkgs; }; +{ users.users = lib.mapAttrs' ( name: instanceCfg: @@ -108,11 +108,11 @@ group = instanceCfg.user; home = instanceCfg.dataDir; createHome = true; } -let pkg = pkgs.callPackage ./pkg.nix { inherit pkgs; }; +{ users.groups = lib.mapAttrs' (name: instanceCfg: lib.nameValuePair instanceCfg.user { }) ( - lib.filterAttrs (name: instanceCfg: instanceCfg.enable) cfg + lib.filterAttrs (name: instanceCfg: instanceCfg.enable) cfg.instances ); }; }