2023-06-07 15:17:07 -04:00
{ config , nixpkgs , pkgs , . . . }:
let
dataDir = " / v a r / l i b / d a r w i n - b u i l d e r " ;
port = 33022 ;
darwin-builder = nixpkgs . lib . nixosSystem {
system = " a a r c h 6 4 - l i n u x " ;
modules = [
" ${ nixpkgs } / n i x o s / m o d u l e s / p r o f i l e s / m a c o s - b u i l d e r . n i x "
{
boot . binfmt . emulatedSystems = [ " x 8 6 _ 6 4 - l i n u x " ] ;
system . nixos . revision = nixpkgs . lib . mkForce null ;
virtualisation . host . pkgs = pkgs ;
virtualisation . darwin-builder . hostPort = port ;
virtualisation . darwin-builder . workingDirectory = dataDir ;
}
] ;
} ;
in
2022-01-06 20:42:24 -05:00
{
nix . distributedBuilds = true ;
2023-06-07 15:17:07 -04:00
nix . buildMachines = [
{
hostName = " s s h : / / b u i l d e r " ;
systems = [ " x 8 6 _ 6 4 - l i n u x " " a a r c h 6 4 - l i n u x " ] ;
maxJobs = 4 ;
speedFactor = 2 ;
supportedFeatures = [ " k v m " " b e n c h m a r k " " b i g - p a r a l l e l " ] ;
}
{
hostName = " s s h : / / p l a t o " ;
systems = [ " x 8 6 _ 6 4 - l i n u x " " a a r c h 6 4 - l i n u x " ] ;
maxJobs = 6 ;
supportedFeatures = [ " n i x o s - t e s t " " b e n c h m a r k " " b i g - p a r a l l e l " " k v m " ] ;
}
] ;
# We can't/want to edit /var/root/.ssh/config so instead we create the config at another location and tell ssh to use that instead by modifying NIX_SSHOPTS
environment . etc . " n i x / s s h _ c o n f i g " . text = ''
Host builder
User builder
HostName 127 .0 .0 .1
Port $ { toString port }
IdentityFile $ { dataDir } /keys/builder_ed25519
Host plato
IdentityFile /var/root/.ssh/id_plato
'' ;
# Tell nix-daemon to use our custom SSH config
nix . envVars = { NIX_SSHOPTS = " - F / e t c / n i x / s s h _ c o n f i g " ; } ;
launchd . daemons . darwin-builder = {
command = " ${ darwin-builder . config . system . build . macos-builder-installer } / b i n / c r e a t e - b u i l d e r " ;
serviceConfig = {
KeepAlive = true ;
RunAtLoad = true ;
StandardOutPath = " / v a r / l o g / d a r w i n - b u i l d e r . l o g " ;
StandardErrorPath = " / v a r / l o g / d a r w i n - b u i l d e r . l o g " ;
} ;
} ;
2022-01-06 20:42:24 -05:00
}