nixos/haproxy: allow to specify haproxy package
This commit is contained in:
parent
b1b263e5f7
commit
90da2c1223
1 changed files with 6 additions and 11 deletions
|
@ -17,14 +17,9 @@ with lib;
|
||||||
options = {
|
options = {
|
||||||
services.haproxy = {
|
services.haproxy = {
|
||||||
|
|
||||||
enable = mkOption {
|
enable = mkEnableOption (lib.mdDoc "HAProxy, the reliable, high performance TCP/HTTP load balancer.");
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
package = mkPackageOptionMD pkgs "haproxy" { };
|
||||||
description = lib.mdDoc ''
|
|
||||||
Whether to enable HAProxy, the reliable, high performance TCP/HTTP
|
|
||||||
load balancer.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
user = mkOption {
|
user = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
@ -70,15 +65,15 @@ with lib;
|
||||||
ExecStartPre = [
|
ExecStartPre = [
|
||||||
# when the master process receives USR2, it reloads itself using exec(argv[0]),
|
# when the master process receives USR2, it reloads itself using exec(argv[0]),
|
||||||
# so we create a symlink there and update it before reloading
|
# so we create a symlink there and update it before reloading
|
||||||
"${pkgs.coreutils}/bin/ln -sf ${pkgs.haproxy}/sbin/haproxy /run/haproxy/haproxy"
|
"${pkgs.coreutils}/bin/ln -sf ${lib.getExe cfg.package} /run/haproxy/haproxy"
|
||||||
# when running the config test, don't be quiet so we can see what goes wrong
|
# when running the config test, don't be quiet so we can see what goes wrong
|
||||||
"/run/haproxy/haproxy -c -f ${haproxyCfg}"
|
"/run/haproxy/haproxy -c -f ${haproxyCfg}"
|
||||||
];
|
];
|
||||||
ExecStart = "/run/haproxy/haproxy -Ws -f /etc/haproxy.cfg -p /run/haproxy/haproxy.pid";
|
ExecStart = "/run/haproxy/haproxy -Ws -f /etc/haproxy.cfg -p /run/haproxy/haproxy.pid";
|
||||||
# support reloading
|
# support reloading
|
||||||
ExecReload = [
|
ExecReload = [
|
||||||
"${pkgs.haproxy}/sbin/haproxy -c -f ${haproxyCfg}"
|
"${lib.getExe cfg.package} -c -f ${haproxyCfg}"
|
||||||
"${pkgs.coreutils}/bin/ln -sf ${pkgs.haproxy}/sbin/haproxy /run/haproxy/haproxy"
|
"${pkgs.coreutils}/bin/ln -sf ${lib.getExe cfg.package} /run/haproxy/haproxy"
|
||||||
"${pkgs.coreutils}/bin/kill -USR2 $MAINPID"
|
"${pkgs.coreutils}/bin/kill -USR2 $MAINPID"
|
||||||
];
|
];
|
||||||
KillMode = "mixed";
|
KillMode = "mixed";
|
||||||
|
|
Loading…
Reference in a new issue