feat: distributed builds

This commit is contained in:
TheGeneralist 2025-07-01 17:30:24 +02:00
parent b2ee468733
commit c9baa840d9
Signed by: thegeneralist01
SSH key fingerprint: SHA256:pp9qddbCNmVNoSjevdvQvM5z0DHN7LTa8qBMbcMq/R4
5 changed files with 59 additions and 20 deletions

View file

@ -1,7 +1,7 @@
age-encryption.org/v1 age-encryption.org/v1
-> ssh-ed25519 pp9qdQ 7QBh40bF+3U+uQaQiZNMVsIWX2ZX162OKbuzgNwIR3A -> ssh-ed25519 pp9qdQ hxgD5olkewZpdkhEmVaGYypGzM403Xa7INBRzt78+kU
Fj2ACjgfeswbIt+ril51zlNaacqgMzkl8p3CQpiUGFo LTj/042NIvyLcDA3VpWO6M+pdl2fhzjyXzA3jWP+III
--- yVZxFaEnzft0ovxvy0CbdIZso0qVMyFPGocBRiONTQM --- E7wuA8Hb4tpfvqQtPxexcGGK9ng/NVhI16XcErKVAFE
b²Q^ 4öø4ƒy!Rq9+AE6î²ÓòÅåW&ÃÇÃt[Ñç.ƒ…â/<2F>ª„ª™J¼<4A>#Bu„zwIïêÖ/ÊGCo¼xÕn©™0Ö1·J¡ckJv/¸p¤qwÿûz B/ßíëÖy<C396>$,¥;IÀ3©wˆYÙ»üòSÔ Œüá8'ß|Ú<>d ù²ùÊ#j9•(æ
ë³ÑP2‡ MAF+[¼ûeNk_Ñ2\ËÆº#d"øÅð§‹Òµw<PPU-­ »M¶G.Ôõ« G/?™¾(qØ#{_C}IìJÚT…Ï»
_ ƒÀ”Á_µõDPž NHQãm¨ †^H¶´É¶<C389>ž­ òY±{aÈÙgfŽs“ S›šø.À

View file

@ -7,15 +7,30 @@
{ {
imports = [ ./hardware-configuration.nix ./site.nix ./cache ]; imports = [ ./hardware-configuration.nix ./site.nix ./cache ];
users.users.thegeneralist = { age.secrets.password.file = ./password.age;
isNormalUser = true; users.users = {
description = "thegeneralist"; thegeneralist = {
extraGroups = [ "wheel" "audio" "video" "input" "scanner" ]; isNormalUser = true;
shell = pkgs.zsh; description = "thegeneralist";
home = "/home/thegeneralist"; extraGroups = [ "wheel" "audio" "video" "input" "scanner" ];
openssh.authorizedKeys.keys = let shell = pkgs.zsh;
inherit (import ../../keys.nix) thegeneralist; home = "/home/thegeneralist";
in [ thegeneralist ]; hashedPasswordFile = config.age.secrets.password.path;
openssh.authorizedKeys.keys = let
inherit (import ../../keys.nix) thegeneralist;
in [ thegeneralist ];
};
build = {
isNormalUser = true;
description = "for distributed builds";
extraGroups = [ "build" ];
shell = pkgs.zsh;
hashedPasswordFile = config.age.secrets.password.path;
openssh.authorizedKeys.keys = let
inherit (import ../../keys.nix) thegeneralist;
in [ thegeneralist ];
};
}; };
home-manager = { home-manager = {

View file

@ -0,0 +1,5 @@
age-encryption.org/v1
-> ssh-ed25519 pp9qdQ hAL4bshCsrk6ICT4G3eH9SUNmrjHxNZyMce0dhvr7S0
TUFsXZVHHRAfV0O4TFcGw/jgAuG0o+kswWyWft1PdxY
--- oBWT2yMt7VN1Oz94ThsyKmhYfB0C3niB4NfTBW+66x0
"»??EGßskÊ„UYAµÊØí<C398>½ðD霈Eõ©òóÞ“¨”lJÛH9ò<39>

View file

@ -1,4 +1,9 @@
{ pkgs, lib, ...}: { { config, pkgs, lib, ...}: let
subs = [
"https://cache.thegeneralist01.com/"
"https://cache.nixos.org/"
];
in {
# todo: gc # todo: gc
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
nh nh
@ -11,15 +16,28 @@
"pipe-operators" "pipe-operators"
]; ];
extra-substituters = [ extra-substituters = subs;
"https://cache.thegeneralist01.com/" trusted-substituters = subs;
];
extra-trusted-public-keys = [ extra-trusted-public-keys = [
"etc.thegeneralist01.com:BIhIf7HJ5xjFX+2e0WrGDQ4LdHeEEyQrtWBB1li2Ve8=" "cache.thegeneralist01.com:jkKcenR877r7fQuWq6cr0JKv2piqBWmYLAYsYsSJnT4="
]; ];
trusted-users = [ "root" "@build" "@wheel" ];
builders-use-substitutes = true;
}; };
nix.distributedBuilds = true;
nix.buildMachines = if (config.networking.hostName != "thegeneralist-central") then [{
hostName = "thegeneralist-central";
maxJobs = 20;
protocol = "ssh-ng";
sshUser = "build";
supportedFeatures = [ "benchmark" "big-parallel" "kvm" "nixos-test" ];
system = "aarch64-linux";
}] else [];
home-manager.sharedModules = [{ home-manager.sharedModules = [{
programs.nh = { programs.nh = {
enable = true; enable = true;

View file

@ -8,6 +8,7 @@ in {
"hosts/thegeneralist-central/cert.pem.age".publicKeys = [ thegeneralist ]; "hosts/thegeneralist-central/cert.pem.age".publicKeys = [ thegeneralist ];
"hosts/thegeneralist-central/credentials.age".publicKeys = [ thegeneralist ]; "hosts/thegeneralist-central/credentials.age".publicKeys = [ thegeneralist ];
"hosts/thegeneralist-central/cache/key.age".publicKeys = [ thegeneralist ]; "hosts/thegeneralist-central/cache/key.age".publicKeys = [ thegeneralist ];
"hosts/thegeneralist-central/password.age".publicKeys = [ thegeneralist ];
"modules/linux/tailscale-marshall.age".publicKeys = [ thegeneralist ]; "modules/linux/tailscale-marshall.age".publicKeys = [ thegeneralist ];
} }