nix/container/Watch.nix

59 lines
1.4 KiB
Nix
Raw Normal View History

2024-06-13 17:00:05 +03:00
{ container, lib, ... } @args: let
2024-06-09 23:35:53 +03:00
cfg = container.config.watch;
2024-06-14 03:57:13 +03:00
memLimit = "8G";
2024-06-09 23:35:53 +03:00
in {
systemd.tmpfiles.rules = container.mkContainerDir cfg [
"data"
"cache"
];
containers.watch = container.mkContainer cfg {
bindMounts = {
"/var/lib/jellyfin" = {
hostPath = "${cfg.storage}/data";
isReadOnly = false;
};
"/var/cache/jellyfin" = {
hostPath = "${cfg.storage}/cache";
isReadOnly = false;
};
2024-06-13 17:00:05 +03:00
"/dev/dri" = {
hostPath = "/dev/dri";
isReadOnly = false;
};
}
// container.attachMedia "anime" cfg.anime true
// container.attachMedia "download" cfg.download true
// container.attachMedia "movie" cfg.movie true
// container.attachMedia "music" cfg.music true
// container.attachMedia "photo" cfg.photo true
2024-06-14 01:18:50 +03:00
// container.attachMedia "porn" cfg.porn true
2024-06-13 17:00:05 +03:00
// container.attachMedia "show" cfg.show true
// container.attachMedia "study" cfg.study true
// container.attachMedia "work" cfg.work true
2024-06-14 01:18:50 +03:00
// container.attachMedia "youtube" cfg.youtube true
;
2024-06-13 17:00:05 +03:00
allowedDevices = [
{
modifier = "rwm";
node = "/dev/dri";
}
];
2024-06-09 23:35:53 +03:00
config = { ... }: container.mkContainerConfig cfg {
services.jellyfin = {
enable = true;
cacheDir = "/var/cache/jellyfin";
dataDir = "/var/lib/jellyfin";
};
2024-06-14 03:57:13 +03:00
systemd.services.jellyfin = {
serviceConfig = {
MemoryLimit = memLimit;
};
};
2024-06-09 23:35:53 +03:00
};
};
}