jellyfin: added jellyfin server config
This commit is contained in:
parent
714cdcea1c
commit
0ef9a409f0
|
@ -13,5 +13,6 @@ in
|
||||||
syncthing.enable = mkEnableOption "syncthing";
|
syncthing.enable = mkEnableOption "syncthing";
|
||||||
openvpn.enable = mkEnableOption "openvpn";
|
openvpn.enable = mkEnableOption "openvpn";
|
||||||
stubby.enable = mkEnableOption "stubby";
|
stubby.enable = mkEnableOption "stubby";
|
||||||
|
jellyfin.enable = mkEnableOption "jellyfin";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
syncthing.enable = true;
|
syncthing.enable = true;
|
||||||
openvpn.enable = true;
|
openvpn.enable = true;
|
||||||
stubby.enable = true;
|
stubby.enable = true;
|
||||||
|
jellyfin.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ let
|
||||||
name = "pihole";
|
name = "pihole";
|
||||||
podman = config.profile.podman;
|
podman = config.profile.podman;
|
||||||
pihole = podman.pihole;
|
pihole = podman.pihole;
|
||||||
inherit (lib) mkIf lists;
|
inherit (lib) mkIf strings attrsets;
|
||||||
gateway = "10.1.1.1";
|
gateway = "10.1.1.1";
|
||||||
subnet = "10.1.1.0/30";
|
subnet = "10.1.1.0/30";
|
||||||
ip = "10.1.1.2";
|
ip = "10.1.1.2";
|
||||||
|
@ -36,8 +36,11 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
# We have refresh the custom.list dns list when caddy virtual hosts changes,
|
# We have refresh the custom.list dns list when caddy virtual hosts changes,
|
||||||
# the easiest way to do so is to restart the pihole container
|
# the easiest way to do so is to restart the pihole container.
|
||||||
systemd.services."podman-${name}".partOf = lists.optional (config.services.caddy.enable) "caddy.service";
|
#
|
||||||
|
# This works by collecting all the virtual hosts defined in caddy
|
||||||
|
# and check if the length of the list changes, if it does, we restart the pihole container.
|
||||||
|
systemd.services."podman-${name}".restartTriggers = attrsets.mapAttrsToList (name: _: name) config.services.caddy.virtualHosts;
|
||||||
environment.etc."pihole/custom.list" = {
|
environment.etc."pihole/custom.list" = {
|
||||||
# Copy file instead of symlink
|
# Copy file instead of symlink
|
||||||
mode = "0444";
|
mode = "0444";
|
||||||
|
|
|
@ -32,7 +32,7 @@ in
|
||||||
|
|
||||||
system.activationScripts."podman-${name}" = ''
|
system.activationScripts."podman-${name}" = ''
|
||||||
mkdir -p ${volume}
|
mkdir -p ${volume}
|
||||||
chown -R ${uid}:${gid} /nas/mediaserver
|
chown -R ${uid}:${gid} ${volume}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
environment.etc."podman/${name}/ytdlp.json" = {
|
environment.etc."podman/${name}/ytdlp.json" = {
|
||||||
|
|
|
@ -10,5 +10,6 @@
|
||||||
./kavita.nix
|
./kavita.nix
|
||||||
./openvpn.nix
|
./openvpn.nix
|
||||||
./stubby.nix
|
./stubby.nix
|
||||||
|
./jellyfin.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
25
system/services/jellyfin.nix
Normal file
25
system/services/jellyfin.nix
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.profile.services.jellyfin;
|
||||||
|
dataDir = "/nas/mediaserver/jellyfin";
|
||||||
|
domain = "jellyfin.tigor.web.id";
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
username = config.profile.user.name;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
users.users.${username}.extraGroups = [ "jellyfin" ];
|
||||||
|
users.users.jellyfin.extraGroups = [ username ];
|
||||||
|
system.activationScripts.jellyfin-prepare = ''
|
||||||
|
mkdir -p ${dataDir}
|
||||||
|
chmod -R 0777 /nas/mediaserver
|
||||||
|
'';
|
||||||
|
services.caddy.virtualHosts.${domain}.extraConfig = ''
|
||||||
|
reverse_proxy 0.0.0.0:8096
|
||||||
|
'';
|
||||||
|
services.jellyfin = {
|
||||||
|
enable = true;
|
||||||
|
inherit dataDir;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue