fix(plex): shared mount

This commit is contained in:
arcnmx 2024-09-27 19:04:49 -07:00
parent 8f4ea912a1
commit 455aca9312
2 changed files with 23 additions and 5 deletions

View file

@ -10,12 +10,23 @@
in {
services.plex.enable = mkDefault true;
systemd.services.plex = mkIf cfg.enable {
gensokyo-zone = {
sharedMounts.plex.path = mkDefault cfg.dataDir;
cacheMounts = {
"plex/Cache" = {
path = mkDefault "${cfg.dataDir}/Cache";
};
"plex/Logs" = {
path = mkDefault "${cfg.dataDir}/Logs";
};
"plex/mesa_shader_cache" = {
path = mkDefault "${cfg.dataDir}/mesa_shader_cache";
};
};
};
# /var/lib/plex/mesa_shader_cache
environment.MESA_SHADER_CACHE_DIR = mkDefault cfg.dataDir;
serviceConfig = {
BindPaths = [
''/mnt/caches/plex/Cache:${cfg.dataDir}/Cache''
];
ExecStartPre = let
# systemd doesn't seem to like spaces so use a symlink instead...
preStartScript = pkgs.writeShellScript "plex-run-prestart" ''
@ -25,6 +36,7 @@ in {
${pkgs.coreutils}/bin/install -d -m 0755 -o ${escapeShellArg cfg.user} -g ${escapeShellArg cfg.group} "$PLEX_DATADIR/Plex Media Server"
fi
${pkgs.coreutils}/bin/ln -sfT ../Cache "$PLEX_DATADIR/Plex Media Server/Cache"
${pkgs.coreutils}/bin/ln -sfT ../Logs "$PLEX_DATADIR/Plex Media Server/Logs"
'';
in
mkForce [