Files
nix-config/nas-apps/sonarr.nix
2024-02-24 23:08:52 -06:00

79 lines
1.5 KiB
Nix

{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.nas-apps.sonarr;
in {
options.nas-apps.sonarr = {
enable = mkEnableOption "sonarr docker service";
autoStart = mkOption {
type = types.bool;
default = true;
};
port = mkOption {
type = types.str;
default = "8989";
};
name = mkOption {
type = types.str;
default = "sonarr";
};
image = mkOption {
type = types.str;
default = "linuxserver/sonarr";
};
configPath = mkOption {
type = types.str;
default = "/mnt/ssd/ssd_app_data/sonarr";
};
tvPath = mkOption {
type = types.str;
default = "/mnt/mainpool/TV";
};
downloadsPath = mkOption {
type = types.str;
default = "/mnt/ssd/ssd_app_data/downloads";
};
puid = mkOption {
type = types.str;
default = "911";
};
pgid = mkOption {
type = types.str;
default = "1000";
};
timeZone = mkOption {
type = types.str;
default = "America/Chicago";
};
};
config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart;
image = cfg.image;
ports = [ "${cfg.port}:8989" ];
volumes = [
"${cfg.configPath}:/config"
"${cfg.tvPath}:/tv"
"${cfg.downloadsPath}:/downloads"
];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
};
};
};
}