X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=nixops%2Fmodules%2Fwebsites%2Fphpfpm%2Fdefault.nix;h=60959e08e9812f0c4a228125146f08cdb14ccaaa;hb=1480d60775dcd38b33abd367a91cd1b865aacc54;hp=882babcd8e9d61a94c9869c3600dee37db2278cb;hpb=981634865c275c1f35e78a27c6d76cd9708fd7ef;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/nixops/modules/websites/phpfpm/default.nix b/nixops/modules/websites/phpfpm/default.nix index 882babc..60959e0 100644 --- a/nixops/modules/websites/phpfpm/default.nix +++ b/nixops/modules/websites/phpfpm/default.nix @@ -83,6 +83,32 @@ in { ''; }; + envFile = mkOption { + default = {}; + type = types.attrsOf types.string; + example = literalExample '' + { mypool = "path/to/file"; + } + ''; + description = '' + Extra environment file go into the service script. + ''; + }; + + preStart = mkOption { + default = {}; + type = types.attrsOf types.lines; + example = literalExample '' + { mypool = ''' + touch foo + '''; + } + ''; + description = '' + Extra lines that will go into the preStart systemd service + ''; + }; + poolPhpConfigs = mkOption { default = {}; type = types.attrsOf types.lines; @@ -169,11 +195,12 @@ in { partOf = [ "phpfpm.target" ]; preStart = '' mkdir -p ${stateDir} - ''; + '' + (cfg.preStart.${pool} or ""); serviceConfig = let cfgFile = fpmCfgFile pool poolConfig; poolPhpIni = cfg.poolPhpConfigs.${pool} or ""; in { + EnvironmentFile = if builtins.hasAttr pool cfg.envFile then [cfg.envFile.${pool}] else []; Slice = "phpfpm.slice"; PrivateDevices = true; ProtectSystem = "full";