Merge pull request #78419 from utsl42/fix-unifi-install

nixos/unifi: use systemd tmpfiles instead of preStart

Changed files
+3 -12
nixos
modules
services
networking
+3 -12
nixos/modules/services/networking/unifi.nix
···
}) mountPoints;
systemd.tmpfiles.rules = [
-
"e '${stateDir}' 0700 unifi - - -"
"d '${stateDir}/data' 0700 unifi - - -"
];
systemd.services.unifi = {
···
unitConfig.RequiresMountsFor = stateDir;
# This a HACK to fix missing dependencies of dynamic libs extracted from jars
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 = {
Type = "simple";
···
}) mountPoints;
systemd.tmpfiles.rules = [
+
"d '${stateDir}' 0700 unifi - - -"
"d '${stateDir}/data' 0700 unifi - - -"
+
"d '${stateDir}/webapps' 0700 unifi - - -"
+
"L+ '${stateDir}/webapps/ROOT' - - - - ${cfg.unifiPackage}/webapps/ROOT"
];
systemd.services.unifi = {
···
unitConfig.RequiresMountsFor = stateDir;
# This a HACK to fix missing dependencies of dynamic libs extracted from jars
environment.LD_LIBRARY_PATH = with pkgs.stdenv; "${cc.cc.lib}/lib";
serviceConfig = {
Type = "simple";