nixos/unifi: use systemd tmpfiles instead of preStart
This commit is contained in:
parent
2a8ad18258
commit
b0208cb80f
1 changed files with 3 additions and 12 deletions
|
@ -147,8 +147,10 @@ in
|
||||||
}) mountPoints;
|
}) mountPoints;
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"e '${stateDir}' 0700 unifi - - -"
|
"d '${stateDir}' 0700 unifi - - -"
|
||||||
"d '${stateDir}/data' 0700 unifi - - -"
|
"d '${stateDir}/data' 0700 unifi - - -"
|
||||||
|
"d '${stateDir}/webapps' 0700 unifi - - -"
|
||||||
|
"L+ '${stateDir}/webapps/ROOT' - - - - ${cfg.unifiPackage}/webapps/ROOT"
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.services.unifi = {
|
systemd.services.unifi = {
|
||||||
|
@ -161,17 +163,6 @@ in
|
||||||
# This a HACK to fix missing dependencies of dynamic libs extracted from jars
|
# This a HACK to fix missing dependencies of dynamic libs extracted from jars
|
||||||
environment.LD_LIBRARY_PATH = with pkgs.stdenv; "${cc.cc.lib}/lib";
|
environment.LD_LIBRARY_PATH = with pkgs.stdenv; "${cc.cc.lib}/lib";
|
||||||
|
|
||||||
preStart = ''
|
|
||||||
# Create the volatile webapps
|
|
||||||
rm -rf "${stateDir}/webapps"
|
|
||||||
mkdir -p "${stateDir}/webapps"
|
|
||||||
ln -s "${cfg.unifiPackage}/webapps/ROOT" "${stateDir}/webapps/ROOT"
|
|
||||||
'';
|
|
||||||
|
|
||||||
postStop = ''
|
|
||||||
rm -rf "${stateDir}/webapps"
|
|
||||||
'';
|
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
ExecStart = "${(removeSuffix "\n" cmd)} start";
|
ExecStart = "${(removeSuffix "\n" cmd)} start";
|
||||||
|
|
Loading…
Reference in a new issue