feat(mediabox): cache storage

This commit is contained in:
arcnmx 2024-02-23 13:52:00 -08:00
parent 4c07a6ed1b
commit cb9acfbdde
5 changed files with 40 additions and 9 deletions

View file

@ -2,12 +2,17 @@
inherit (lib.modules) mkIf mkDefault;
cfg = config.services.plex;
in {
services.plex.enable = true;
services.plex.enable = mkDefault true;
systemd.services.plex = mkIf cfg.enable {
# /var/lib/plex/mesa_shader_cache
environment.MESA_SHADER_CACHE_DIR = mkDefault cfg.dataDir;
serviceConfig = {
BindPaths = [
"/mnt/caches/plex/Cache:${cfg.dataDir}/Plex Media Server/Cache"
];
# KillMode = "mixed" doesn't behave as expected...
serviceConfig.TimeoutStopSec = 5;
TimeoutStopSec = 5;
};
};
# Plex Media Server:

View file

@ -1,8 +1,16 @@
{lib, ...}: let
inherit (lib.modules) mkDefault;
{config, lib, ...}: let
inherit (lib.modules) mkIf mkDefault;
cfg = config.services.tautulli;
in {
services.tautulli = {
enable = mkDefault true;
port = mkDefault 8181;
};
systemd.services.tautulli = mkIf cfg.enable {
serviceConfig = {
BindPaths = [
"/mnt/caches/plex/tautulli/cache:${cfg.dataDir}/cache"
];
};
};
}

View file

@ -36,10 +36,10 @@
inherit (inputs.self.lib.lib) userIs;
inherit (inputs.self.nixosConfigurations.hakurei.config) users;
authorizedKeys = list.concatMap (user: user.openssh.authorizedKeys.keys) (
list.filter (userIs "wheel") users.users
list.filter (userIs "wheel") (set.values users.users)
);
inputs = {
INPUT_ROOT_SSH_AUTHORIZEDKEYS = pkgs.writeTextFile "root.authorized_keys" (
inputAttrs = {
INPUT_ROOT_SSH_AUTHORIZEDKEYS = pkgs.writeText "root.authorized_keys" (
string.intercalate "\n" authorizedKeys
);
INPUT_TF_SSH_AUTHORIZEDKEYS = reisen + "/tf.authorized_keys";
@ -51,7 +51,7 @@
INPUT_INFRA_MKPAM = reisen + "/bin/mkpam.sh";
INPUT_INFRA_CT_CONFIG = reisen + "/bin/ct-config.sh";
};
inputVars = set.mapToValues (key: path: ''${key}="$(base64 -w0 < ${path})"'') inputs;
inputVars = set.mapToValues (key: path: ''${key}="$(base64 -w0 < ${path})"'') inputAttrs;
in pkgs.writeShellScriptBin "nf-setup-node" ''
${exports}
NF_SETUP_INPUTS=(

View file

@ -3,6 +3,7 @@
"lxc.mount.entry": [
"/mnt/kyuuto-media/library mnt/kyuuto-media/library none bind,optional,create=dir",
"/mnt/kyuuto-media/downloads/deluge mnt/kyuuto-media/downloads/deluge none bind,optional,create=dir",
"/rpool/caches/plex mnt/caches/plex none bind,optional,create=dir",
"/dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file"
],
"lxc.idmap": [

View file

@ -109,3 +109,20 @@ if [[ ! -d /rpool/shared/nix/var ]]; then
mkdir /rpool/shared/nix/var
fi
chown 100000:100000 /rpool/shared/nix/var
if [[ ! -d /rpool/caches ]]; then
zfs create rpool/caches
fi
if [[ ! -d /rpool/caches/plex ]]; then
zfs create rpool/caches/plex
fi
if [[ ! -d /rpool/caches/plex/Cache ]]; then
mkdir /rpool/caches/plex/Cache
fi
if [[ ! -d /rpool/caches/plex/tautulli/cache ]]; then
mkdir -p /rpool/caches/plex/tautulli/cache
fi
chown 100193:100193 /rpool/caches/plex/Cache
chmod 0775 /rpool/caches/plex/Cache
chown 100195:65534 /rpool/caches/plex/tautulli/cache
chmod 0755 /rpool/caches/plex/tautulli/cache