Hi. I’m trying to configure HAProxy in NixOS, using something like this:
{ lib, config, pkgs, nixpkgs-unstable, ... }:
{
imports = [ ../oauth2-proxy/default.nix ];
services.haproxy = {
package = pkgs.unstable.haproxy;
enable = true;
config = lib.concatLines [
''
global
lua-load ${./haproxy-lua-http.lua}
lua-load ${./auth-request.lua}
''
(builtins.readFile ./haproxy.cfg)
];
};
environment.systemPackages = with pkgs; [
(lua.withPackages(ps: with ps; [ cjson ]))
];
users.groups.certs.members = [ "haproxy" ];
}
auth-request.lua has the line
local http = require("haproxy-lua-http")
and thus it requires a file named precisely “haproxy-lua-http.lua” to be loaded. When that file is added to the Nix store, however, the filename is changed so a hash can be added to it. Is there some way to circumvent this, for example by convincing Nix to make the path “/nix/store/asd1234-something/haproxy-lua-http.lua” instead of “/nix/store/asd1234-haproxy-lua-http.lua”? Since the documentation is so bad, I was not able to find anything on this.
I do not want to somehow patch the correct path into auth-request.lua, as this would probably be very complicated to do as well, especially since there is so little documentation on how I would do this. But maybe there is a very simple way to do this and it could be the better solution.