Files
nix-config/modules/nixos/services/ersatztv/default.nix
mjallen18 d49a2744d2 format
2025-11-21 11:28:17 -06:00

62 lines
1.4 KiB
Nix

{
lib,
config,
namespace,
...
}:
with lib;
let
inherit (lib.${namespace}) mkOpt mkReverseProxyOpt;
cfg = config.${namespace}.services.ersatztv;
in
{
options.${namespace}.services.ersatztv = {
enable = mkEnableOption "ersatztv service";
name = mkOpt types.str "ersatztv" "container name";
image = mkOpt types.str "ghcr.io/ersatztv/ersatztv" "container image";
port = mkOpt types.int 8409 "Port for ersatztv to be hosted on";
configPath = mkOpt types.str "" "Path to the data dir";
moviesPath = mkOpt types.str "" "Path to the data dir";
tvPath = mkOpt types.str "" "Path to the data dir";
transcodePath = mkOpt types.str "" "Path to the data dir";
puid = mkOpt types.str "911" "uid";
pgid = mkOpt types.str "1000" "gid";
timeZone = mkOpt types.str "America/Chicago" "Timezone";
reverseProxy = mkReverseProxyOpt;
};
config = mkIf cfg.enable {
virtualisation.oci-containers.containers.${cfg.name} = {
autoStart = true;
image = cfg.image;
extraOptions = [ "--device=/dev/dri" ];
volumes = [
"${cfg.configPath}:/config"
"${cfg.moviesPath}:/libraries/movies"
"${cfg.tvPath}:/libraries/tv"
"${cfg.transcodePath}:/transcode"
];
ports = [
"${toString cfg.port}:8409"
];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
};
};
};
}