refactor: abstract app user creation via custom options

This commit is contained in:
Tibo De Peuter 2026-07-17 23:26:03 +02:00
parent 1403b1f9c0
commit d742671460
Signed by: tdpeuter
SSH key fingerprint: SHA256:u/h/LVoqKF1Iz02uOyxe6hcjmoZASCGV2HM0TG9ZMoU
7 changed files with 52 additions and 36 deletions

View file

@ -95,22 +95,17 @@ in {
};
# Create a user for each app.
users.users = let
homelab.appUsers = let
mkUser = uid: {
uid = lib.mkForce uid;
isSystemUser = true;
inherit uid;
group = config.users.groups.media.name;
home = "/var/empty";
shell = null;
};
in {
bazarr = lib.mkIf cfg.bazarr.enable (mkUser 3003);
prowlarr = lib.mkIf cfg.prowlarr.enable (mkUser 3004);
qbittorrent = lib.mkIf cfg.qbittorrent.enable (mkUser 3005) // {
extraGroups = [
config.users.groups.apps.name
];
};
qbittorrent = lib.mkIf cfg.qbittorrent.enable ((mkUser 3005) // {
extraGroups = [ config.users.groups.apps.name ];
});
radarr = lib.mkIf cfg.radarr.enable (mkUser 3006);
sonarr = lib.mkIf cfg.sonarr.enable (mkUser 3007);
};