mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
feat(mediabox): cache storage
This commit is contained in:
parent
4c07a6ed1b
commit
cb9acfbdde
5 changed files with 40 additions and 9 deletions
|
|
@ -2,12 +2,17 @@
|
||||||
inherit (lib.modules) mkIf mkDefault;
|
inherit (lib.modules) mkIf mkDefault;
|
||||||
cfg = config.services.plex;
|
cfg = config.services.plex;
|
||||||
in {
|
in {
|
||||||
services.plex.enable = true;
|
services.plex.enable = mkDefault true;
|
||||||
systemd.services.plex = mkIf cfg.enable {
|
systemd.services.plex = mkIf cfg.enable {
|
||||||
# /var/lib/plex/mesa_shader_cache
|
# /var/lib/plex/mesa_shader_cache
|
||||||
environment.MESA_SHADER_CACHE_DIR = mkDefault cfg.dataDir;
|
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...
|
# KillMode = "mixed" doesn't behave as expected...
|
||||||
serviceConfig.TimeoutStopSec = 5;
|
TimeoutStopSec = 5;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Plex Media Server:
|
# Plex Media Server:
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,16 @@
|
||||||
{lib, ...}: let
|
{config, lib, ...}: let
|
||||||
inherit (lib.modules) mkDefault;
|
inherit (lib.modules) mkIf mkDefault;
|
||||||
|
cfg = config.services.tautulli;
|
||||||
in {
|
in {
|
||||||
services.tautulli = {
|
services.tautulli = {
|
||||||
enable = mkDefault true;
|
enable = mkDefault true;
|
||||||
port = mkDefault 8181;
|
port = mkDefault 8181;
|
||||||
};
|
};
|
||||||
|
systemd.services.tautulli = mkIf cfg.enable {
|
||||||
|
serviceConfig = {
|
||||||
|
BindPaths = [
|
||||||
|
"/mnt/caches/plex/tautulli/cache:${cfg.dataDir}/cache"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,10 @@
|
||||||
inherit (inputs.self.lib.lib) userIs;
|
inherit (inputs.self.lib.lib) userIs;
|
||||||
inherit (inputs.self.nixosConfigurations.hakurei.config) users;
|
inherit (inputs.self.nixosConfigurations.hakurei.config) users;
|
||||||
authorizedKeys = list.concatMap (user: user.openssh.authorizedKeys.keys) (
|
authorizedKeys = list.concatMap (user: user.openssh.authorizedKeys.keys) (
|
||||||
list.filter (userIs "wheel") users.users
|
list.filter (userIs "wheel") (set.values users.users)
|
||||||
);
|
);
|
||||||
inputs = {
|
inputAttrs = {
|
||||||
INPUT_ROOT_SSH_AUTHORIZEDKEYS = pkgs.writeTextFile "root.authorized_keys" (
|
INPUT_ROOT_SSH_AUTHORIZEDKEYS = pkgs.writeText "root.authorized_keys" (
|
||||||
string.intercalate "\n" authorizedKeys
|
string.intercalate "\n" authorizedKeys
|
||||||
);
|
);
|
||||||
INPUT_TF_SSH_AUTHORIZEDKEYS = reisen + "/tf.authorized_keys";
|
INPUT_TF_SSH_AUTHORIZEDKEYS = reisen + "/tf.authorized_keys";
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
INPUT_INFRA_MKPAM = reisen + "/bin/mkpam.sh";
|
INPUT_INFRA_MKPAM = reisen + "/bin/mkpam.sh";
|
||||||
INPUT_INFRA_CT_CONFIG = reisen + "/bin/ct-config.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" ''
|
in pkgs.writeShellScriptBin "nf-setup-node" ''
|
||||||
${exports}
|
${exports}
|
||||||
NF_SETUP_INPUTS=(
|
NF_SETUP_INPUTS=(
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
"lxc.mount.entry": [
|
"lxc.mount.entry": [
|
||||||
"/mnt/kyuuto-media/library mnt/kyuuto-media/library none bind,optional,create=dir",
|
"/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",
|
"/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"
|
"/dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file"
|
||||||
],
|
],
|
||||||
"lxc.idmap": [
|
"lxc.idmap": [
|
||||||
|
|
|
||||||
|
|
@ -109,3 +109,20 @@ if [[ ! -d /rpool/shared/nix/var ]]; then
|
||||||
mkdir /rpool/shared/nix/var
|
mkdir /rpool/shared/nix/var
|
||||||
fi
|
fi
|
||||||
chown 100000:100000 /rpool/shared/nix/var
|
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue