lib.nix
1 # SPDX-FileCopyrightText: 2024-2025 sntx <sntx@sntx.space> 2 # SPDX-License-Identifier: AGPL-3.0-or-later 3 4 { cell, inputs }: 5 let 6 inherit (inputs) nixpkgs; 7 8 commonBuildSystems = { 9 protocol = "ssh-ng"; 10 systems = [ 11 "aarch64-linux" 12 "x86_64-linux" 13 ]; 14 supportedFeatures = [ 15 "kvm" 16 "ca-derivations" 17 # "recursive-nix" 18 # "uid-range" 19 20 # historical pseudo-features 21 "benchmark" 22 "big-parallel" 23 "nixos-test" 24 ]; 25 }; 26 in 27 rec { 28 l = nixpkgs.lib // builtins; 29 30 enableForHosts = 31 config: hosts: option: 32 let 33 cond = 34 if l.typeOf option == "string" then 35 l.optionalString 36 else if l.typeOf option == "list" then 37 l.optionals 38 else 39 l.mkIf; 40 in 41 cond (l.elem config.networking.hostName hosts) option; 42 43 nixpkgsWithOverlays = ( 44 (inputs.nixpkgs.extend ( 45 final: prev: { 46 inherit (prev.lixPackageSets.stable) 47 nixpkgs-review 48 nix-eval-jobs 49 nix-fast-build 50 ; 51 } 52 )).extend 53 inputs.nixpkgs-xr.overlays.default 54 ); 55 56 buildMachines = { 57 apollo-build = { 58 hostName = "apollo"; 59 system = "x86_64-linux"; 60 maxJobs = 32; 61 speedFactor = 35985; 62 } 63 // commonBuildSystems; 64 65 vesta-build = { 66 hostName = "vesta"; 67 system = "x86_64-linux"; 68 maxJobs = 48; 69 speedFactor = 34255; 70 } 71 // commonBuildSystems; 72 }; 73 }