Put hydra behind nginx

This commit is contained in:
Alejandro Angulo 2024-03-05 20:03:34 -08:00
parent f2056710ed
commit 9480e24301
Signed by: alejandro-angulo
GPG key ID: 75579581C74554B6
2 changed files with 35 additions and 1 deletions

View file

@ -10,6 +10,21 @@ with lib; let
in { in {
options.aa.services.hydra = with types; { options.aa.services.hydra = with types; {
enable = mkEnableOption "hydra"; enable = mkEnableOption "hydra";
hostname = mkOption {
type = str;
default = "hydra.kilonull.com";
description = ''
The hostname for the hydra instance
'';
};
acmeCertName = mkOption {
type = str;
default = "";
description = ''
If set to a non-empty string, forces SSL with the supplied acme
certificate.
'';
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -22,12 +37,27 @@ in {
services.hydra = { services.hydra = {
enable = true; enable = true;
hydraURL = "http://localhost:3000"; hydraURL = "https://${cfg.hostname}";
notificationSender = "hydra@localhost"; notificationSender = "hydra@localhost";
buildMachinesFiles = []; buildMachinesFiles = [];
useSubstitutes = true; useSubstitutes = true;
}; };
services.nginx = {
enable = true;
recommendedProxySettings = true;
virtualHosts."hydra.kilonull.com" =
{
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.services.hydra.port}";
};
}
// lib.optionalAttrs (cfg.acmeCertName != "") {
forceSSL = true;
useACMEHost = cfg.acmeCertName;
};
};
nix.settings = { nix.settings = {
allowed-users = [ allowed-users = [
"hydra" "hydra"

View file

@ -55,6 +55,10 @@
}; };
services.prometheus.enable = true; services.prometheus.enable = true;
services.promtail.enable = true; services.promtail.enable = true;
services.hydra = {
enable = true;
acmeCertName = "kilonull.com";
};
hardware.audio.enable = true; hardware.audio.enable = true;
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;