This commit is contained in:
Julien Malka 2021-12-21 18:58:23 +01:00
commit 13dac666f7
2 changed files with 52 additions and 19 deletions

View file

@ -14,25 +14,11 @@ in
luj = {
filerun.enable = true;
zfs-mails.enable = true;
};
services.hydra = {
enable = true;
hydraURL = "https://hydra.julienmalka.me";
notificationSender = "hydra@localhost";
port = 9876;
buildMachinesFiles = [ ];
useSubstitutes = true;
};
services.nginx = {
enable = true;
virtualHosts = {
"hydra.julienmalka.me" = {
forceSSL = true;
enableACME = true;
locations."/" = { proxyPass = "http://127.0.0.1:9876"; };
hydra = {
enable = true;
nginx = {
enable = true;
subdomain = "hydra";
};
};
};

47
modules/hydra/default.nix Normal file
View file

@ -0,0 +1,47 @@
{ lib, pkgs, 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";
port = port;
buildMachinesFiles = [ ];
useSubstitutes = true;
};
networking.firewall = { allowedTCPPorts = [ port ]; };
}
(mkIf cfg.nginx.enable {
luj.nginx.enable = true;
services.hydra.hydraURL = "${cfg.nginx.subdomain}.julienmalka.me";
services.nginx.virtualHosts."${cfg.nginx.subdomain}.julienmalka.me" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:${toString port}";
};
};
})]);
}