infrastructure/machines/nixos/build01/nix-builder.nix
Ryan Lahfa b5fe7bd71f
All checks were successful
Check meta / check_dns (pull_request) Successful in 16s
Check meta / check_meta (pull_request) Successful in 17s
Check workflows / check_workflows (pull_request) Successful in 19s
Build all the nodes / netcore01 (pull_request) Successful in 22s
Build all the nodes / ap01 (pull_request) Successful in 33s
Build all the nodes / netcore02 (pull_request) Successful in 31s
Build all the nodes / netaccess01 (pull_request) Successful in 35s
Build the shell / build-shell (pull_request) Successful in 23s
Build all the nodes / hypervisor01 (pull_request) Successful in 1m29s
Build all the nodes / bridge01 (pull_request) Successful in 1m35s
Build all the nodes / hypervisor02 (pull_request) Successful in 1m33s
Build all the nodes / hypervisor03 (pull_request) Successful in 1m34s
Build all the nodes / build01 (pull_request) Successful in 1m41s
Build all the nodes / geo02 (pull_request) Successful in 1m42s
Run pre-commit on all files / pre-commit (pull_request) Successful in 39s
Build all the nodes / geo01 (pull_request) Successful in 1m44s
Build all the nodes / tower01 (pull_request) Successful in 1m27s
Build all the nodes / web02 (pull_request) Successful in 1m34s
Build all the nodes / storage01 (pull_request) Successful in 1m51s
Build all the nodes / rescue01 (pull_request) Successful in 1m52s
Build all the nodes / vault01 (pull_request) Successful in 1m49s
Build all the nodes / web01 (pull_request) Successful in 1m55s
Build all the nodes / web03 (pull_request) Successful in 1m51s
Build all the nodes / compute01 (pull_request) Successful in 2m27s
Build all the nodes / netcore02 (push) Successful in 22s
Build all the nodes / netaccess01 (push) Successful in 23s
Build all the nodes / netcore01 (push) Successful in 23s
Build all the nodes / ap01 (push) Successful in 34s
Build all the nodes / geo01 (push) Successful in 1m21s
Build all the nodes / geo02 (push) Successful in 1m23s
Build all the nodes / bridge01 (push) Successful in 1m29s
Build all the nodes / tower01 (push) Successful in 1m40s
Build all the nodes / storage01 (push) Successful in 1m42s
Build all the nodes / hypervisor01 (push) Successful in 1m47s
Build all the nodes / hypervisor03 (push) Successful in 1m49s
Build all the nodes / hypervisor02 (push) Successful in 1m50s
Build all the nodes / build01 (push) Successful in 1m53s
Build all the nodes / rescue01 (push) Successful in 2m3s
Build the shell / build-shell (push) Successful in 38s
Build all the nodes / vault01 (push) Successful in 1m42s
Build all the nodes / compute01 (push) Successful in 2m11s
Run pre-commit on all files / pre-commit (push) Successful in 31s
Build all the nodes / web01 (push) Successful in 2m3s
Build all the nodes / web02 (push) Successful in 1m42s
Build all the nodes / web03 (push) Successful in 1m47s
feat(machines/nixos/build01/nix-builder): add builder-specific keys via dgn-keys
Reuses the commit on builder-specific keys.

Signed-off-by: Ryan Lahfa <ryan@dgnum.eu>
2025-02-06 01:30:45 +01:00

77 lines
1.9 KiB
Nix

# SPDX-FileCopyrightText: 2025 Elias Coppens <elias@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{
pkgs,
lib,
dgn-keys,
meta,
...
}:
{
config = {
dgn-access-control.users = lib.genAttrs meta.organization.groups.nix-builder (u: lib.singleton u);
# FIXME(Raito): this should really go into `dgn-access-control` but I don't
# know what is the desired architecture for it. Leaving it for the people with opinions™.
users.groups.nix-builders = { };
users.users = lib.genAttrs meta.organization.groups.nix-builder (u: {
extraGroups = [ "nix-builders" ];
openssh.authorizedKeys.keys = dgn-keys.getBuilderKeys u;
});
security.pam.loginLimits = [
{
domain = "*";
item = "nofile";
type = "-";
value = "20480";
}
];
systemd.services.nix-daemon.serviceConfig = {
MemoryAccounting = true;
MemoryMax = "450G";
MemoryHigh = "440G";
MemorySwapMax = "2G";
ManagedOOMSwap = "kill";
ManagedOOMMemoryPressure = "kill";
MemoryPressureWatch = "on";
};
nix = {
gc = {
automatic = true;
dates = lib.mkForce "*:45";
options = lib.mkForce ''--max-freed "$((128 * 1024**3 - 1024 * $(df -P -k /nix/store | tail -n 1 | ${pkgs.gawk}/bin/awk '{ print $4 }')))"'';
randomizedDelaySec = "1800";
};
nrBuildUsers = 128;
settings = {
trusted-users = [
"@wheel"
"@nix-builders"
];
keep-outputs = false;
keep-derivations = false;
use-cgroups = true;
http-connections = 0;
auto-allocate-uids = true;
cores = 0;
max-jobs = 8;
fsync-metadata = true;
experimental-features = [
"auto-allocate-uids"
# "ca-derivations" this feature is really extremely broken.
"cgroups"
"fetch-closure"
"impure-derivations"
];
};
};
};
}