mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
fix(plex): cache mount
This commit is contained in:
parent
0ff920215b
commit
dc4072da45
2 changed files with 21 additions and 7 deletions
|
|
@ -1,5 +1,6 @@
|
|||
{config, lib, ...}: let
|
||||
inherit (lib.modules) mkIf mkDefault;
|
||||
{config, lib, pkgs, ...}: let
|
||||
inherit (lib.modules) mkIf mkForce mkDefault;
|
||||
inherit (lib.strings) escapeShellArg;
|
||||
cfg = config.services.plex;
|
||||
in {
|
||||
services.plex.enable = mkDefault true;
|
||||
|
|
@ -8,7 +9,20 @@ in {
|
|||
environment.MESA_SHADER_CACHE_DIR = mkDefault cfg.dataDir;
|
||||
serviceConfig = {
|
||||
BindPaths = [
|
||||
"/mnt/caches/plex/Cache:${cfg.dataDir}/Plex Media Server/Cache"
|
||||
''/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" ''
|
||||
set -eu
|
||||
|
||||
if [[ ! -d $PLEX_DATADIR ]]; then
|
||||
${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"
|
||||
'';
|
||||
in mkForce [
|
||||
''!${preStartScript}''
|
||||
];
|
||||
# KillMode = "mixed" doesn't behave as expected...
|
||||
TimeoutStopSec = 5;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue