emby service: allow changing data directory

This commit is contained in:
Pascal Bach 2017-05-12 22:01:25 +02:00
parent 9f6b1dca58
commit 1541140473

View File

@ -22,6 +22,12 @@ in
default = "emby";
description = "Group under which emby runs.";
};
dataDir = mkOption {
type = types.path;
default = "/var/lib/emby/ProgramData-Server";
description = "Location where Emby stores its data.";
};
};
};
@ -31,10 +37,10 @@ in
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
preStart = ''
test -d /var/lib/emby/ProgramData-Server || {
echo "Creating initial Emby data directory in /var/lib/emby/ProgramData-Server"
mkdir -p /var/lib/emby/ProgramData-Server
chown -R ${cfg.user}:${cfg.group} /var/lib/emby/ProgramData-Server
test -d ${cfg.dataDir} || {
echo "Creating initial Emby data directory in ${cfg.dataDir}"
mkdir -p ${cfg.dataDir}
chown -R ${cfg.user}:${cfg.group} ${cfg.dataDir}
}
'';