{ nixpkgs ? , nixpkgs-unpatched ? null, system ? builtins.currentSystem, }: let nixpkgs-unpatched' = if nixpkgs-unpatched == null then nixpkgs else nixpkgs-unpatched; localSystems = rec { x86_64-linux.system = "x86_64-linux"; aarch64-linux.system = "aarch64-linux"; riscv64-linux.system = "riscv64-linux"; default.system = system; skylake = x86_64-linux // { gcc.arch = "skylake"; gcc.tune = "skylake"; }; skylake-avx512 = skylake; # Currently none of my builders support avx512. Revisit when upgraded to znver4 neoverse-n1 = aarch64-linux // { gcc.arch = "armv8.2-a"; gcc.tune = "neoverse-n1"; }; znver1 = x86_64-linux // { gcc.arch = "znver1"; gcc.tune = "znver1"; }; znver2 = x86_64-linux // { gcc.arch = "znver2"; gcc.tune = "znver2"; }; rv64_zba_zbb = riscv64-linux // { gcc.arch = "rv64_zba_zbb"; }; }; pkgs-unpatched = import nixpkgs-unpatched' { inherit system; overlays = [ (_: _: { nixpkgs-unpatched = nixpkgs-unpatched'; }) (import ./overlay.nix) ]; config.contentAddressedByDefault = true; }; pkgsFor = system: args: import nixpkgs (args // { localSystem = localSystems.${system}; overlays = [ (_: _: { nixpkgs-unpatched = nixpkgs-unpatched'; }) (import ./overlay.nix) ]; }); keepBuilt = system: let pkgs = pkgsFor system {}; in { inherit (pkgs) nixos-rebuild; }; in { inherit (pkgs-unpatched) nixpkgs; inherit pkgsFor; x86_64-linux = keepBuilt "x86_64-linux"; aarch64-linux = keepBuilt "aarch64-linux"; default = keepBuilt "default"; skylake = keepBuilt "skylake"; skylake-avx512 = keepBuilt "skylake-avx512"; neoverse-n1 = keepBuilt "neoverse-n1"; znver1 = keepBuilt "znver1"; znver2 = keepBuilt "znver2"; rv64_zba_zbb = keepBuilt "rv64_zba_zbb"; }