nixos: abstract out distributed builds

This commit is contained in:
Luke Granger-Brown 2020-07-19 18:20:21 +01:00
parent 6b2df5840e
commit 24ba5c1c36
3 changed files with 22 additions and 15 deletions

View file

@ -0,0 +1,20 @@
# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
#
# SPDX-License-Identifier: Apache-2.0
{ pkgs, depot, lib, ... }:
{
# Distributed builds!
nix.buildMachines = [ {
hostName = "whitby";
system = "x86_64-linux";
maxJobs = 64;
speedFactor = 2;
supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
mandatoryFeatures = [ ];
}];
nix.distributedBuilds = true;
nix.extraOptions = ''
builders-use-substitutes = true
'';
}

View file

@ -19,6 +19,7 @@ in {
imports = [ imports = [
../lib/zfs.nix ../lib/zfs.nix
../lib/client.nix ../lib/client.nix
../lib/whitby-distributed.nix
]; ];
boot.initrd.availableKernelModules = [ boot.initrd.availableKernelModules = [

View file

@ -7,7 +7,7 @@ let
inherit (depot.ops) secrets; inherit (depot.ops) secrets;
in { in {
imports = imports =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix> ../lib/client.nix ]; [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix> ../lib/client.nix ../lib/whitby-distributed.nix ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ]; boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ];
boot.kernelModules = lib.mkAfter [ "kvm-intel" ]; boot.kernelModules = lib.mkAfter [ "kvm-intel" ];
@ -73,19 +73,5 @@ in {
networking.firewall.allowedTCPPorts = [ 111 2049 ]; networking.firewall.allowedTCPPorts = [ 111 2049 ];
networking.firewall.allowedUDPPorts = [ 111 2049 ]; networking.firewall.allowedUDPPorts = [ 111 2049 ];
# Distributed builds!
nix.buildMachines = [ {
hostName = "whitby";
system = "x86_64-linux";
maxJobs = 64;
speedFactor = 2;
supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
mandatoryFeatures = [ ];
}] ;
nix.distributedBuilds = true;
nix.extraOptions = ''
builders-use-substitutes = true
'';
system.stateVersion = "20.03"; system.stateVersion = "20.03";
} }