@@ -492,57 +492,65 @@ in {
492492 } )
493493 ] ;
494494
495- buildkiteOnly = [
496- ( { lib , ...} : {
497- # Temporarily disable nomad to avoid conflict with buildkite resource consumption
495+ buildkiteOnly = queue : count : [
496+ ( {
497+ lib ,
498+ config ,
499+ ...
500+ } : let
501+ cfg = config . services . buildkite-containers ;
502+ in {
503+ # Temporarily disable nomad to avoid conflict with buildkite resource consumption.
498504 services . nomad . enable = lib . mkForce false ;
505+
506+ # We don't need to purge 10 MB daily from the nix store by default.
507+ nix . gc . automatic = lib . mkForce false ;
508+
509+ services . auto-gc = {
510+ # Apply some auto and hourly gc thresholds
511+ nixAutoMaxFreedGB = 150 ;
512+ nixAutoMinFreeGB = 90 ;
513+ nixHourlyMaxFreedGB = 600 ;
514+ nixHourlyMinFreeGB = 150 ;
515+
516+ # The auto and hourly gc should negate the need for a weekly full gc.
517+ nixWeeklyGcFull = false ;
518+ } ;
519+
520+ services . buildkite-containers = {
521+ # There should be enough space on these machines to cache dir purges.
522+ weeklyCachePurge = false ;
523+
524+ containerList = let
525+ mkContainer = n : prio : {
526+ containerName = "ci${ cfg . hostIdSuffix } -${ toString n } " ;
527+ guestIp = "10.254.1.1${ toString n } " ;
528+ inherit prio ;
529+ tags = {
530+ inherit queue ;
531+ system = "x86_64-linux" ;
532+ } ;
533+ } ;
534+ in
535+ map ( n : mkContainer n ( toString ( 10 - n ) ) ) ( lib . range 1 count ) ;
536+ } ;
499537 } )
500538 ] ;
501- in {
502- equinix-1 = {
503- inherit deployType node_class primaryInterface role ;
539+
540+ mkEquinixBuildkite = name : privateIP : queue : count : {
541+ inherit deployType node_class primaryInterface role privateIP ;
504542 equinix = { inherit plan project ; } ;
505- privateIP = "147.75.85.17" ;
506543
507544 modules =
508545 baseEquinixModuleConfig
509- ++ ( baseEquinixMachineConfig "equinix-1" )
510- ++ buildkiteOnly
511- ++ [
512- ./buildkite/buildkite-agent-containers.nix
513- (
514- {
515- config ,
516- lib ,
517- ...
518- } : let
519- cfg = config . services . buildkite-containers ;
520- in {
521- services . auto-gc = {
522- nixAutoMaxFreedGB = 150 ;
523- nixAutoMinFreeGB = 90 ;
524- nixHourlyMaxFreedGB = 600 ;
525- nixHourlyMinFreeGB = 150 ;
526- nixWeeklyGcFull = true ;
527- nixWeeklyGcOnCalendar = "Sat *-*-* 20:00:00" ;
528- } ;
529-
530- services . buildkite-containers . containerList = let
531- mkContainer = n : prio : {
532- containerName = "ci${ cfg . hostIdSuffix } -${ toString n } " ;
533- guestIp = "10.254.1.1${ toString n } " ;
534- inherit prio ;
535- tags = {
536- system = "x86_64-linux" ;
537- queue = "test" ;
538- } ;
539- } ;
540- in
541- map ( n : mkContainer n ( toString ( 10 - n ) ) ) ( lib . range 1 5 ) ;
542- }
543- )
544- ] ;
546+ ++ ( baseEquinixMachineConfig name )
547+ ++ ( buildkiteOnly queue count )
548+ ++ [ ./buildkite/buildkite-agent-containers.nix ] ;
545549 } ;
550+ in {
551+ equinix-1 = mkEquinixBuildkite "equinix-1" "10.12.10.1" "default" 5 ;
552+ equinix-2 = mkEquinixBuildkite "equinix-2" "10.12.10.3" "default" 5 ;
553+ equinix-3 = mkEquinixBuildkite "equinix-3" "10.12.10.5" "benchmark" 1 ;
546554 } ;
547555 } ;
548556 } ;
0 commit comments