snowfield/modules/hydra/default.nix
2024-03-30 20:21:59 +01:00

38 lines
771 B
Nix

{ lib, config, ... }:
with lib;
let
cfg = config.luj.hydra;
port = 9876;
in
{
options.luj.hydra = {
enable = mkEnableOption "activate hydra service";
nginx.enable = mkEnableOption "activate nginx";
nginx.subdomain = mkOption {
type = types.str;
};
};
config = mkIf cfg.enable (
mkMerge [{
services.hydra = {
enable = true;
notificationSender = "hydra@localhost";
inherit port;
buildMachinesFiles = [ ];
useSubstitutes = true;
};
networking.firewall = { allowedTCPPorts = [ port ]; };
}
(mkIf cfg.nginx.enable (recursiveUpdate {
services.hydra.hydraURL = "${cfg.nginx.subdomain}.julienmalka.me";
} (mkSubdomain cfg.nginx.subdomain port)) )]);
}