fix: fixes cyclical reference?

This commit is contained in:
Lewis Wynne 2026-04-07 16:09:53 +01:00
parent 2fdfc58317
commit 69b35ba3c2

View file

@ -175,20 +175,15 @@ in
description = "Node.js web site services with git clone, build, and webhook support."; description = "Node.js web site services with git clone, build, and webhook support.";
}; };
options.services.siteWebhookPort = mkOption { config = mkMerge ((mapAttrsToList makeSiteConfig cfg) ++ [{
type = types.port; systemd.services.site-webhook = mkIf (cfg != {}) {
default = 4323;
description = "Port for the shared site rebuild webhook listener.";
};
config = mkIf (cfg != {}) (mkMerge ((mapAttrsToList makeSiteConfig cfg) ++ [{
systemd.services.site-webhook = {
description = "Webhook listener for site rebuilds"; description = "Webhook listener for site rebuilds";
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig = { serviceConfig = {
Type = "simple"; Type = "simple";
ExecStart = let ExecStart = let
webhookPort = 4323;
allHooks = mapAttrsToList (name: site: { allHooks = mapAttrsToList (name: site: {
id = "${name}-rebuild"; id = "${name}-rebuild";
execute-command = "/run/current-system/sw/bin/touch"; execute-command = "/run/current-system/sw/bin/touch";
@ -197,10 +192,10 @@ in
]; ];
}) cfg; }) cfg;
hooksFile = pkgs.writeText "site-hooks.json" (builtins.toJSON allHooks); hooksFile = pkgs.writeText "site-hooks.json" (builtins.toJSON allHooks);
in "${pkgs.webhook}/bin/webhook -hooks ${hooksFile} -port ${toString config.services.siteWebhookPort} -verbose"; in "${pkgs.webhook}/bin/webhook -hooks ${hooksFile} -port ${toString webhookPort} -verbose";
Restart = "always"; Restart = "always";
DynamicUser = true; DynamicUser = true;
}; };
}; };
}])); }]);
} }