0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

tandoor_recipes: use static user and group instead of DynamicUser

Signed-off-by: Ilya Savitsky <ilya.savitsky@codethink.co.uk>
This commit is contained in:
Ilya Savitsky 2025-02-17 15:17:47 +00:00 committed by Ilya Savitsky
parent 29f6170dc8
commit fe2727c45b

View file

@ -75,10 +75,33 @@ in
}; };
}; };
user = lib.mkOption {
type = lib.types.str;
default = "tandoor_recipes";
description = "User account under which Tandoor runs.";
};
group = lib.mkOption {
type = lib.types.str;
default = "tandoor_recipes";
description = "Group under which Tandoor runs.";
};
package = lib.mkPackageOption pkgs "tandoor-recipes" { }; package = lib.mkPackageOption pkgs "tandoor-recipes" { };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
users.users = lib.mkIf (cfg.user == "tandoor_recipes") {
tandoor-recipes = {
inherit (cfg) group;
isSystemUser = true;
};
};
users.groups = lib.mkIf (cfg.group == "tandoor_recipes") {
tandoor-recipes = { };
};
systemd.services.tandoor-recipes = { systemd.services.tandoor-recipes = {
description = "Tandoor Recipes server"; description = "Tandoor Recipes server";
@ -88,9 +111,8 @@ in
''; '';
Restart = "on-failure"; Restart = "on-failure";
User = "tandoor_recipes"; User = cfg.user;
Group = "tandoor_recipes"; Group = cfg.group;
DynamicUser = true;
StateDirectory = "tandoor-recipes"; StateDirectory = "tandoor-recipes";
WorkingDirectory = env.MEDIA_ROOT; WorkingDirectory = env.MEDIA_ROOT;
RuntimeDirectory = "tandoor-recipes"; RuntimeDirectory = "tandoor-recipes";