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

91 lines
1.8 KiB
Nix

{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.nas-apps.sabnzbd;
in {
options.nas-apps.sabnzbd = {
enable = mkEnableOption "sabnzbd docker service";
autoStart = mkOption {
type = types.bool;
default = true;
};
port = mkOption {
type = types.str;
default = "8080";
};
name = mkOption {
type = types.str;
default = "sabnzbd";
};
image = mkOption {
type = types.str;
default = "linuxserver/sabnzbd";
};
configPath = mkOption {
type = types.str;
default = "/mnt/ssd/ssd_app_data/sabnzbd";
};
moviesPath = mkOption {
type = types.str;
default = "/mnt/mainpool/Movies";
};
tvPath = mkOption {
type = types.str;
default = "/mnt/mainpool/Tv";
};
downloadsPath = mkOption {
type = types.str;
default = "/mnt/ssd/ssd_app_data/downloads";
};
downloadsIncompletePath = mkOption {
type = types.str;
default = "/mnt/ssd/ssd_app_data/downloads-incomplete";
};
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}:8080" ];
volumes = [
"${cfg.configPath}:/config"
"${cfg.moviesPath}:/movies"
"${cfg.tvPath}:/tv"
"${cfg.downloadsPath}:/downloads"
"${cfg.downloadsIncompletePath}:/downloads-incomplete"
];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
};
};
};
}