from my phone so i cant see the changes lol
This commit is contained in:
69
modules/containers/jellyfin/container.nix
Normal file
69
modules/containers/jellyfin/container.nix
Normal file
@@ -0,0 +1,69 @@
|
||||
{moduleWithSystem, ...}: {
|
||||
flake.nixosModules.containerJellyfin = moduleWithSystem ({pkgs, ...}: {
|
||||
virtualisation.oci-containers.containers."jellyfin" = {
|
||||
image = "jellyfin/jellyfin";
|
||||
environment = {
|
||||
"JELLYFIN_PublishedServerUrl" = "https://watch.voidarc.co.uk";
|
||||
};
|
||||
volumes = [
|
||||
"/containers/jellyfin/cache:/cache:rw"
|
||||
"/containers/jellyfin/config:/config:rw"
|
||||
"/mnt/storage/streaming:/media:rw"
|
||||
];
|
||||
ports = [
|
||||
"8096:8096/tcp"
|
||||
"7359:7359/udp"
|
||||
];
|
||||
user = "0:0";
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--add-host=host.docker.internal:host-gateway"
|
||||
"--device=nvidia.com/gpu=all"
|
||||
"--network-alias=jellyfin"
|
||||
"--network=jellyfin_default"
|
||||
];
|
||||
};
|
||||
systemd.services."podman-jellyfin" = {
|
||||
serviceConfig = {
|
||||
Restart = pkgs.lib.mkOverride 90 "always";
|
||||
};
|
||||
after = [
|
||||
"podman-network-jellyfin_default.service"
|
||||
];
|
||||
requires = [
|
||||
"podman-network-jellyfin_default.service"
|
||||
];
|
||||
partOf = [
|
||||
"podman-compose-jellyfin-root.target"
|
||||
];
|
||||
wantedBy = [
|
||||
"podman-compose-jellyfin-root.target"
|
||||
];
|
||||
};
|
||||
|
||||
# Networks
|
||||
systemd.services."podman-network-jellyfin_default" = {
|
||||
path = [pkgs.podman];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStop = "podman network rm -f jellyfin_default";
|
||||
};
|
||||
script = ''
|
||||
podman network inspect jellyfin_default || podman network create jellyfin_default
|
||||
'';
|
||||
partOf = ["podman-compose-jellyfin-root.target"];
|
||||
wantedBy = ["podman-compose-jellyfin-root.target"];
|
||||
};
|
||||
|
||||
# Root service
|
||||
# When started, this will automatically create all resources and start
|
||||
# the containers. When stopped, this will teardown all resources.
|
||||
systemd.targets."podman-compose-jellyfin-root" = {
|
||||
unitConfig = {
|
||||
Description = "Root target generated by compose2nix.";
|
||||
};
|
||||
wantedBy = ["multi-user.target"];
|
||||
};
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user