From 50281dab558c686d031fcc8c562330eb05e7dfe8 Mon Sep 17 00:00:00 2001 From: Sam Pointon Date: Fri, 17 Apr 2026 16:48:24 +0100 Subject: [PATCH] nixos/haproxy: drop redundant and faulty config check See https://github.com/haproxy/haproxy/issues/3341. There are multiple issues with the current code: 0. It doesn't work at all if you're doing socket activation and passing file descriptors to HAProxy to bind to: systemd doesn't pass the FDs in ExecStartPre, but haproxy -c requires them. 1. More generally, HAProxy upstream recommends making the invocation of haproxy -c identical to the actual invocation of haproxy. This is awkward to achieve without putting the check immediately before the service start... but what's the point in that when it fails anyway? 2. Hence, upstream recommends just removing the check and letting the (re)start fail if it's going to. So, let's just do that and remove it: the check isn't load bearing and is actively causing problems. --- nixos/modules/services/networking/haproxy.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/nixos/modules/services/networking/haproxy.nix b/nixos/modules/services/networking/haproxy.nix index 0397b5f2d641..0d9271854882 100644 --- a/nixos/modules/services/networking/haproxy.nix +++ b/nixos/modules/services/networking/haproxy.nix @@ -68,13 +68,10 @@ in # when the master process receives USR2, it reloads itself using exec(argv[0]), # so we create a symlink there and update it before reloading "${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 - "/run/haproxy/haproxy -c -f ${haproxyCfg}" ]; ExecStart = "/run/haproxy/haproxy -Ws -f /etc/haproxy.cfg -p /run/haproxy/haproxy.pid"; # support reloading ExecReload = [ - "${lib.getExe cfg.package} -c -f ${haproxyCfg}" "${pkgs.coreutils}/bin/ln -sf ${lib.getExe cfg.package} /run/haproxy/haproxy" "${pkgs.coreutils}/bin/kill -USR2 $MAINPID" ];