mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-24 06:33:42 +00:00
ef176dcf7e
conversions were done using https://github.com/pennae/nix-doc-munge using (probably) rev f34e145 running nix-doc-munge nixos/**/*.nix nix-doc-munge --import nixos/**/*.nix the tool ensures that only changes that could affect the generated manual *but don't* are committed, other changes require manual review and are discarded.
84 lines
2.0 KiB
Nix
84 lines
2.0 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.radarr;
|
|
|
|
in
|
|
{
|
|
options = {
|
|
services.radarr = {
|
|
enable = mkEnableOption (lib.mdDoc "Radarr");
|
|
|
|
package = mkOption {
|
|
description = lib.mdDoc "Radarr package to use";
|
|
default = pkgs.radarr;
|
|
defaultText = literalExpression "pkgs.radarr";
|
|
example = literalExpression "pkgs.radarr";
|
|
type = types.package;
|
|
};
|
|
|
|
dataDir = mkOption {
|
|
type = types.str;
|
|
default = "/var/lib/radarr/.config/Radarr";
|
|
description = lib.mdDoc "The directory where Radarr stores its data files.";
|
|
};
|
|
|
|
openFirewall = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = lib.mdDoc "Open ports in the firewall for the Radarr web interface.";
|
|
};
|
|
|
|
user = mkOption {
|
|
type = types.str;
|
|
default = "radarr";
|
|
description = lib.mdDoc "User account under which Radarr runs.";
|
|
};
|
|
|
|
group = mkOption {
|
|
type = types.str;
|
|
default = "radarr";
|
|
description = lib.mdDoc "Group under which Radarr runs.";
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
systemd.tmpfiles.rules = [
|
|
"d '${cfg.dataDir}' 0700 ${cfg.user} ${cfg.group} - -"
|
|
];
|
|
|
|
systemd.services.radarr = {
|
|
description = "Radarr";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
Type = "simple";
|
|
User = cfg.user;
|
|
Group = cfg.group;
|
|
ExecStart = "${cfg.package}/bin/Radarr -nobrowser -data='${cfg.dataDir}'";
|
|
Restart = "on-failure";
|
|
};
|
|
};
|
|
|
|
networking.firewall = mkIf cfg.openFirewall {
|
|
allowedTCPPorts = [ 7878 ];
|
|
};
|
|
|
|
users.users = mkIf (cfg.user == "radarr") {
|
|
radarr = {
|
|
group = cfg.group;
|
|
home = cfg.dataDir;
|
|
uid = config.ids.uids.radarr;
|
|
};
|
|
};
|
|
|
|
users.groups = mkIf (cfg.group == "radarr") {
|
|
radarr.gid = config.ids.gids.radarr;
|
|
};
|
|
};
|
|
}
|