clan/machines/moritz-server/nixarr/radarr.nix
2025-08-26 20:15:11 +02:00

48 lines
1.4 KiB
Nix

{
pkgs,
config,
...
}: {
clan.core.vars.generators."nixarr-radarr" = {
prompts.password = {
type = "hidden";
persist = true;
description = "Leave empty to generate automatically";
};
files.password.deploy = false;
runtimeInputs = [
pkgs.coreutils
pkgs.xkcdpass
];
script = ''
prompt_value="$(cat "$prompts/password")"
if [[ -n "''${prompt_value-}" ]]; then
echo "$prompt_value" | tr -d "\n" > "$out"/password
else
xkcdpass --numwords 4 --delimiter - --count 1 | tr -d "\n" > "$out"/password
fi
'';
};
nixarr.radarr = {
# NOTE: cannot set password so just set the generated one manually
enable = true;
};
services.nginx.virtualHosts."radarr.moritz.place" = {
forceSSL = true;
useACMEHost = "any.moritz.place";
locations."/" = {
proxyPass = "http://127.0.0.1:7878";
};
};
fileSystems."/mnt/ds_movies" = {
device = "//192.168.0.2/media/movies";
fsType = "cifs";
options = let
# this line prevents hanging on network split
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
in ["${automount_opts},credentials=${config.clan.core.vars.generators.nixarr-ds-share.files.config.path},gid=${builtins.toString config.users.groups.media.gid},uid=${builtins.toString config.users.users.radarr.uid}"];
};
}