2024-06-25 04:04:39 +03:00
|
|
|
{ container, lib, config, ... }: with lib; let
|
|
|
|
cfg = config.container.module.watch;
|
2024-06-09 23:35:53 +03:00
|
|
|
in {
|
2024-06-25 04:04:39 +03:00
|
|
|
options = {
|
|
|
|
container.module.watch = {
|
|
|
|
enable = mkEnableOption "Media server.";
|
|
|
|
address = mkOption {
|
|
|
|
default = "10.1.0.11";
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
port = mkOption {
|
|
|
|
default = 8096;
|
|
|
|
type = types.int;
|
|
|
|
};
|
|
|
|
domain = mkOption {
|
|
|
|
default = "watch.${config.container.domain}";
|
|
|
|
type = types.str;
|
2024-06-09 23:35:53 +03:00
|
|
|
};
|
2024-06-25 04:04:39 +03:00
|
|
|
storage = mkOption {
|
|
|
|
default = "${config.container.storage}/watch";
|
|
|
|
type = types.str;
|
2024-06-09 23:35:53 +03:00
|
|
|
};
|
2024-06-25 04:04:39 +03:00
|
|
|
memLimit = mkOption {
|
|
|
|
default = "8G";
|
|
|
|
type = types.str;
|
2024-06-13 17:00:05 +03:00
|
|
|
};
|
2024-06-25 04:04:39 +03:00
|
|
|
};
|
|
|
|
};
|
2024-06-13 17:00:05 +03:00
|
|
|
|
2024-06-25 04:04:39 +03:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.tmpfiles.rules = container.mkContainerDir cfg [
|
|
|
|
"data"
|
|
|
|
"cache"
|
2024-06-13 17:00:05 +03:00
|
|
|
];
|
2024-06-09 23:35:53 +03:00
|
|
|
|
2024-06-25 04:04:39 +03:00
|
|
|
containers.watch = container.mkContainer cfg {
|
|
|
|
bindMounts = {
|
|
|
|
"/var/lib/jellyfin" = {
|
|
|
|
hostPath = "${cfg.storage}/data";
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
"/var/cache/jellyfin" = {
|
|
|
|
hostPath = "${cfg.storage}/cache";
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
"/dev/dri" = {
|
|
|
|
hostPath = "/dev/dri";
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
// container.attachMedia "anime" true
|
|
|
|
// container.attachMedia "download" true
|
|
|
|
// container.attachMedia "movie" true
|
|
|
|
// container.attachMedia "music" true
|
|
|
|
// container.attachMedia "photo" true
|
|
|
|
// container.attachMedia "porn" true
|
|
|
|
// container.attachMedia "show" true
|
|
|
|
// container.attachMedia "study" true
|
|
|
|
// container.attachMedia "work" true
|
|
|
|
// container.attachMedia "youtube" true
|
|
|
|
;
|
|
|
|
|
|
|
|
allowedDevices = [
|
|
|
|
{
|
|
|
|
modifier = "rwm";
|
2024-07-13 17:37:08 +03:00
|
|
|
node = "/dev/dri/renderD128";
|
2024-06-25 04:04:39 +03:00
|
|
|
}
|
|
|
|
];
|
2024-06-14 03:57:13 +03:00
|
|
|
|
2024-06-25 04:04:39 +03:00
|
|
|
config = { ... }: container.mkContainerConfig cfg {
|
2024-07-13 17:37:08 +03:00
|
|
|
# users.users.jellyfin.extraGroups = [
|
|
|
|
# "video"
|
|
|
|
# "render"
|
|
|
|
# ];
|
|
|
|
|
2024-06-25 04:04:39 +03:00
|
|
|
services.jellyfin = {
|
|
|
|
enable = true;
|
|
|
|
cacheDir = "/var/cache/jellyfin";
|
|
|
|
dataDir = "/var/lib/jellyfin";
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.jellyfin.serviceConfig.MemoryLimit = cfg.memLimit;
|
|
|
|
};
|
2024-06-09 23:35:53 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|