nix-config/hosts/hydra/hydra.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

147 lines
4.1 KiB
Nix
Raw Normal View History

2022-06-24 01:02:11 +02:00
{ hostRegistry, hydra-ca, config, lib, pkgs, ... }:
2022-06-22 00:16:03 +02:00
{
2022-06-24 01:02:11 +02:00
containers = {
hydra-ca = {
autoStart = true;
config = { ... }: {
imports = [
hydra-ca.nixosModules.hydra
];
2022-07-01 01:30:31 +02:00
environment.systemPackages = with pkgs; [ git ];
2022-06-24 01:02:11 +02:00
networking.firewall.allowedTCPPorts = [ 3001 ];
2022-06-24 01:14:37 +02:00
nix = {
settings = {
substituters = [
"https://cache.ngi0.nixos.org/"
];
trusted-public-keys = [
"cache.ngi0.nixos.org-1:KqH5CBLNSyX184S9BKZJo1LxrxJ9ltnY2uAs5c/f1MA="
];
};
extraOptions = ''
2022-06-28 20:58:07 +02:00
allowed-uris = https://gitea.c3d2.de/ https://github.com/ https://gitlab.com/ ssh://gitea@gitea.c3d2.de/
2022-07-01 01:30:46 +02:00
builders-use-substitutes = true
2022-06-24 01:14:37 +02:00
experimental-features = ca-derivations nix-command flakes
2022-07-01 01:30:46 +02:00
extra-substituters = https://cache.ngi0.nixos.org/
extra-trusted-public-keys = cache.ngi0.nixos.org-1:KqH5CBLNSyX184S9BKZJo1LxrxJ9ltnY2uAs5c/f1MA=
2022-06-24 01:14:37 +02:00
'';
2022-06-24 01:02:11 +02:00
};
2022-06-24 03:01:36 +02:00
nixpkgs.overlays = [ (import ../../overlay) ];
2022-06-24 01:02:11 +02:00
services = {
hydra-dev = lib.recursiveUpdate config.services.hydra-dev {
hydraURL = "https://hydra-ca.hq.c3d2.de";
port = 3001;
};
};
};
hostAddress = "192.168.100.1";
localAddress = "192.168.100.2";
privateNetwork = true;
};
};
networking.nat = {
enable = true;
externalInterface = "serv";
internalInterfaces = [ "ve-hydra-ca" ];
};
2021-03-12 21:45:12 +01:00
nix = {
extraOptions = lib.mkForce ''
allowed-uris = http:// https:// ssh://
builders-use-substitutes = true
experimental-features = ca-derivations nix-command flakes
2021-03-12 21:45:12 +01:00
'';
trustedUsers = [ "hydra" "root" ];
2022-06-23 20:22:23 +02:00
buildMachines = [{
hostName = "localhost";
system = lib.concatStringsSep "," ([
2022-06-23 20:22:23 +02:00
pkgs.system
"i686-linux"
] ++ config.boot.binfmt.emulatedSystems);
2022-05-05 22:34:51 +02:00
supportedFeatures = [ "big-parallel" "benchmark" "kvm" "nixos-test" ];
2022-05-07 01:01:02 +02:00
inherit (config.nix) maxJobs;
2022-06-23 20:22:23 +02:00
# } {
# hostName = "client@dacbert.hq.c3d2.de";
# system = lib.concatStringsSep "," [
# "aarch64-linux" "armv6l-linux" "armv7l-linux"
# ];
# supportedFeatures = [ "kvm" "benchmark" "nixos-test" ];
# maxJobs = 1;
}];
daemonCPUSchedPolicy = "idle";
daemonIOSchedClass = "idle";
daemonIOSchedPriority = 7;
2021-03-12 21:45:12 +01:00
};
2022-06-23 20:22:23 +02:00
services = {
hydra-dev = {
enable = true;
hydraURL = "https://hydra.hq.c3d2.de";
logo = ./c3d2.svg;
minimumDiskFree = 1;
minimumDiskFreeEvaluator = 1;
notificationSender = "hydra@spam.works";
useSubstitutes = true;
extraConfig =
let
key = config.sops.secrets."nix-serve/secretKey".path;
in
''
binary_cache_secret_key_file = ${key}
evaluator_workers = 4
2022-06-23 20:22:23 +02:00
evaluator_max_memory_size = 2048
store_uri = auto?secret-key=${key}&write-nar-listing=1&ls-compression=zstd&log-compression=zstd
upload_logs_to_binary_cache = true
'';
};
nginx =
let
hydraVhost = {
forceSSL = true;
enableACME = true;
2022-06-24 01:02:11 +02:00
locations."/".proxyPass = "http://localhost:${toString config.services.hydra.port}";
2022-06-23 20:22:23 +02:00
};
in
{
enable = true;
virtualHosts = {
"hydra.hq.c3d2.de" = hydraVhost // {
default = true;
};
2022-06-24 01:02:11 +02:00
"hydra-ca.hq.c3d2.de" = hydraVhost // {
locations."/".proxyPass = "http://192.168.100.2:3001";
};
2022-06-23 20:22:23 +02:00
"hydra.serv.zentralwerk.org" = hydraVhost;
2022-06-24 01:02:11 +02:00
"nix-serve.hq.c3d2.de" = hydraVhost; # TODO: remove
2022-06-23 20:22:23 +02:00
};
};
2022-06-24 01:02:11 +02:00
resolved.enable = false;
2021-03-12 21:45:12 +01:00
};
2022-06-12 17:26:32 +02:00
2022-06-23 20:22:23 +02:00
sops.secrets."nix-serve/secretKey".mode = "0444";
2022-05-07 00:50:01 +02:00
systemd.services = {
hydra-evaluator.serviceConfig = {
CPUWeight = 2;
MemoryHigh = "64G";
MemoryMax = "64G";
MemorySwapMax = "64G";
2022-05-07 00:50:01 +02:00
};
2022-06-13 15:48:05 +02:00
nix-daemon.serviceConfig = {
2022-06-09 17:45:23 +02:00
LimitNOFILE = lib.mkForce 8192;
CPUWeight = 5;
2022-06-23 22:10:06 +02:00
MemoryHigh = "64G";
MemoryMax = "64G";
MemorySwapMax = "64G";
2022-06-12 17:26:32 +02:00
};
};
2021-03-12 21:45:12 +01:00
}