summaryrefslogtreecommitdiff
path: root/modules/build-machines.nix
blob: d9db08f656db27593fcee90d3d5bc5f934007259 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{lib, config, ...}:

let
  machines = {
    pinto = {
      maxJobs = 2;
      protocol = "ssh-ng";
      system = "x86_64-linux";
      supportedFeatures = ["big-parallel" "kvm"];
    };
  };
  enabled = config.this.buildMachines;

  inherit (lib.attrsets) filterAttrs;
in
{
  options = {
    this.buildMachines = lib.mkOption {
      type = with lib.types; listOf str;
      default = [];
    };
  };

  config = {
    nix.buildMachines = builtins.map
      (m: machines."${m}" // { hostName = m; })
      enabled;
    nix.distributedBuilds = (enabled == []);
    nix.extraOptions = lib.mkIf (enabled != []) ''
      builders-use-substitutes = true
    '';
  };
}