forked from CCCHH/nix-infra
hydra: configure hydra host
This commit is contained in:
parent
ec64eebfd6
commit
4f789adb21
8 changed files with 138 additions and 0 deletions
9
config/hosts/hydra/configuration.nix
Normal file
9
config/hosts/hydra/configuration.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
networking = {
|
||||
hostName = "hydra";
|
||||
};
|
||||
|
||||
system.stateVersion = "24.05";
|
||||
}
|
11
config/hosts/hydra/default.nix
Normal file
11
config/hosts/hydra/default.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./configuration.nix
|
||||
./hydra.nix
|
||||
./networking.nix
|
||||
./nginx.nix
|
||||
./nix.nix
|
||||
];
|
||||
}
|
15
config/hosts/hydra/hydra.nix
Normal file
15
config/hosts/hydra/hydra.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
services.hydra = {
|
||||
enable = true;
|
||||
listenHost = "localhost";
|
||||
port = 3000;
|
||||
hydraURL = "https://hydra.hamburg.ccc.de/";
|
||||
# E-Mail configuration requires some work/investigation still.
|
||||
notificationSender = "no-reply@hydra.hamburg.ccc.de";
|
||||
useSubstitutes = true;
|
||||
minimumDiskFree = 8;
|
||||
minimumDiskFreeEvaluator = 2;
|
||||
};
|
||||
}
|
22
config/hosts/hydra/networking.nix
Normal file
22
config/hosts/hydra/networking.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
networking = {
|
||||
interfaces.net0 = {
|
||||
ipv4.addresses = [
|
||||
{
|
||||
address = "172.31.17.163";
|
||||
prefixLength = 25;
|
||||
}
|
||||
];
|
||||
};
|
||||
defaultGateway = "172.31.17.129";
|
||||
nameservers = [ "212.12.50.158" "192.76.134.90" ];
|
||||
search = [ "hamburg.ccc.de" ];
|
||||
};
|
||||
|
||||
systemd.network.links."10-net0" = {
|
||||
matchConfig.MACAddress = "BC:24:11:45:7C:D6";
|
||||
linkConfig.Name = "net0";
|
||||
};
|
||||
}
|
58
config/hosts/hydra/nginx.nix
Normal file
58
config/hosts/hydra/nginx.nix
Normal file
|
@ -0,0 +1,58 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
domain = "hydra.hamburg.ccc.de";
|
||||
in
|
||||
{
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
|
||||
virtualHosts = {
|
||||
"acme-${domain}" = {
|
||||
default = true;
|
||||
enableACME = true;
|
||||
serverName = "${domain}";
|
||||
|
||||
listen = [
|
||||
{
|
||||
addr = "0.0.0.0";
|
||||
port = 31820;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
"${domain}" = {
|
||||
default = true;
|
||||
forceSSL = true;
|
||||
useACMEHost = "${domain}";
|
||||
|
||||
listen = [
|
||||
{
|
||||
addr = "0.0.0.0";
|
||||
port = 8443;
|
||||
ssl = true;
|
||||
proxyProtocol = true;
|
||||
}
|
||||
];
|
||||
|
||||
locations."/" = {
|
||||
proxyPass = "http://${config.services.hydra.listenHost}:${builtins.toString config.services.hydra.port}";
|
||||
};
|
||||
|
||||
extraConfig = ''
|
||||
# Make use of the ngx_http_realip_module to set the $remote_addr and
|
||||
# $remote_port to the client address and client port, when using proxy
|
||||
# protocol.
|
||||
# First set our proxy protocol proxy as trusted.
|
||||
set_real_ip_from 172.31.17.140;
|
||||
# Then tell the realip_module to get the addreses from the proxy protocol
|
||||
# header.
|
||||
real_ip_header proxy_protocol;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 8443 31820 ];
|
||||
networking.firewall.allowedUDPPorts = [ 8443 ];
|
||||
}
|
10
config/hosts/hydra/nix.nix
Normal file
10
config/hosts/hydra/nix.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
# Allow Hydra to fetch flake inputs.
|
||||
nix.settings.allowed-uris = [
|
||||
"github:"
|
||||
"https://github.com/"
|
||||
"https://git.hamburg.ccc.de/"
|
||||
];
|
||||
}
|
|
@ -32,6 +32,9 @@
|
|||
},
|
||||
"penpot": {
|
||||
"targetHostname": "penpot-intern.hamburg.ccc.de"
|
||||
},
|
||||
"hydra": {
|
||||
"targetHostname": "hydra-intern.hamburg.ccc.de"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
10
flake.nix
10
flake.nix
|
@ -254,6 +254,16 @@
|
|||
./config/hosts/penpot
|
||||
];
|
||||
};
|
||||
|
||||
hydra = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [
|
||||
./config/common
|
||||
./config/proxmox-vm
|
||||
./config/extra/prometheus-exporter.nix
|
||||
./config/hosts/hydra
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
packages.x86_64-linux = {
|
||||
|
|
Loading…
Reference in a new issue