Distributed build: Difference between revisions

imported>IgorM
fixed instructions for trusted-users in nix
m Extend explanations of buildMachines
Line 103: Line 103:


{
{
nix.buildMachines = [ {
  # You can see the resulting builder-strings of this NixOS-configuration with "cat /etc/nix/machines".
hostName = "builder";
  # These builder-strings are used by the Nix terminal tool, e.g.
system = "x86_64-linux";
  # when calling "nix build ...".
                  protocol = "ssh-ng";
  nix.buildMachines = [{
# if the builder supports building for multiple architectures,  
    # Will be used to call "ssh <hostName>" to connect to the builder machine.
# replace the previous line by, e.g.
    # The details of the connection (user, port, url etc.)
# systems = ["x86_64-linux" "aarch64-linux"];
    # are taken from your "~/.ssh/config" file.
maxJobs = 1;
    hostName = "builder";
speedFactor = 2;
    # CPU architecture of the builder, and the operating system it runs.
supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
    # Replace the line by the architecture of your builder, e.g.
mandatoryFeatures = [ ];
    # - Normal Intel/AMD CPUs use "x86_64-linux"
}] ;
    # - Raspberry Pi 4 and 5 use  "aarch64-linux"
nix.distributedBuilds = true;
    # - M1, M2, M3 ARM Macs use  "aarch64-darwin"
# optional, useful when the builder has a faster internet connection than yours
    # - Newer RISCV computers use "riscv64-linux"
nix.extraOptions = ''
    # If your builder supports multiple architectures
  builders-use-substitutes = true
    # (e.g. search for "binfmt" for emulation),
'';
    # you can list them all, e.g. replace with
    # systems = ["x86_64-linux" "aarch64-linux" "riscv64-linux"];
    system = "x86_64-linux";
    protocol = "ssh-ng";
    # default is 1 but may keep the builder idle in between builds
    maxJobs = 3;
    # how fast is the builder compared to your local machine
    speedFactor = 2;
    supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
    mandatoryFeatures = [ ];
  }];
  # required, otherwise remote buildMachines above aren't used
  nix.distributedBuilds = true;
  # optional, useful when the builder has a faster internet connection than yours
  nix.extraOptions = ''
    builders-use-substitutes = true
  '';
}
}
</nowiki>}}
</nowiki>}}