mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 07:53:19 +00:00
Merge pull request #64113 from davidtwco/lidarr/users-groups-firewalls
nixos/lidarr: add user/group/openFirewall opts.
This commit is contained in:
commit
823120765c
@ -16,6 +16,30 @@ in
|
||||
defaultText = "pkgs.lidarr";
|
||||
description = "The Lidarr package to use";
|
||||
};
|
||||
|
||||
openFirewall = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Open ports in the firewall for Lidarr
|
||||
'';
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "lidarr";
|
||||
description = ''
|
||||
User account under which Lidarr runs.
|
||||
'';
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = types.str;
|
||||
default = "lidarr";
|
||||
description = ''
|
||||
Group under which Lidarr runs.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@ -27,8 +51,8 @@ in
|
||||
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
User = "lidarr";
|
||||
Group = "lidarr";
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
ExecStart = "${cfg.package}/bin/Lidarr";
|
||||
Restart = "on-failure";
|
||||
|
||||
@ -37,12 +61,21 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
users.users.lidarr = {
|
||||
uid = config.ids.uids.lidarr;
|
||||
home = "/var/lib/lidarr";
|
||||
group = "lidarr";
|
||||
networking.firewall = mkIf cfg.openFirewall {
|
||||
allowedTCPPorts = [ 8686 ];
|
||||
};
|
||||
|
||||
users.groups.lidarr.gid = config.ids.gids.lidarr;
|
||||
users.users = mkIf (cfg.user == "lidarr") {
|
||||
lidarr = {
|
||||
group = cfg.group;
|
||||
uid = config.ids.uids.lidarr;
|
||||
};
|
||||
};
|
||||
|
||||
users.groups = mkIf (cfg.group == "lidarr") {
|
||||
lidarr = {
|
||||
gid = config.ids.gids.lidarr;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user