From 24ba5c1c369759d6d1ac0024bd13f6026a47858c Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sun, 19 Jul 2020 18:20:21 +0100 Subject: [PATCH] nixos: abstract out distributed builds --- ops/nixos/lib/whitby-distributed.nix | 20 ++++++++++++++++++++ ops/nixos/porcorosso/default.nix | 1 + ops/nixos/totoro/default.nix | 16 +--------------- 3 files changed, 22 insertions(+), 15 deletions(-) create mode 100644 ops/nixos/lib/whitby-distributed.nix diff --git a/ops/nixos/lib/whitby-distributed.nix b/ops/nixos/lib/whitby-distributed.nix new file mode 100644 index 0000000000..2c222bc6e6 --- /dev/null +++ b/ops/nixos/lib/whitby-distributed.nix @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: 2020 Luke Granger-Brown +# +# 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 + ''; +} diff --git a/ops/nixos/porcorosso/default.nix b/ops/nixos/porcorosso/default.nix index 01ff696ccb..786d90ddf9 100644 --- a/ops/nixos/porcorosso/default.nix +++ b/ops/nixos/porcorosso/default.nix @@ -19,6 +19,7 @@ in { imports = [ ../lib/zfs.nix ../lib/client.nix + ../lib/whitby-distributed.nix ]; boot.initrd.availableKernelModules = [ diff --git a/ops/nixos/totoro/default.nix b/ops/nixos/totoro/default.nix index 6e4f01e7a0..08563c80d0 100644 --- a/ops/nixos/totoro/default.nix +++ b/ops/nixos/totoro/default.nix @@ -7,7 +7,7 @@ let inherit (depot.ops) secrets; in { imports = - [ ../lib/client.nix ]; + [ ../lib/client.nix ../lib/whitby-distributed.nix ]; boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ]; boot.kernelModules = lib.mkAfter [ "kvm-intel" ]; @@ -73,19 +73,5 @@ in { networking.firewall.allowedTCPPorts = [ 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"; }