per-system-optim/default.nix

78 lines
1.8 KiB
Nix
Raw Normal View History

2023-06-02 06:29:02 +00:00
{
nixpkgs ? <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";
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";
};
};
pkgs-unpatched = import nixpkgs-unpatched' {
inherit system;
overlays = [
(_: _: {
nixpkgs-unpatched = nixpkgs-unpatched';
})
(import ./overlay.nix)
];
config.contentAddressedByDefault = true;
};
2023-06-03 09:41:41 +00:00
pkgsFor = system: args:
2023-06-02 06:29:02 +00:00
import nixpkgs (args
// {
2023-06-03 09:41:41 +00:00
localSystem = localSystems.${system};
2023-06-02 06:29:02 +00:00
overlays = [
(_: _: {
nixpkgs-unpatched = nixpkgs-unpatched';
})
(import ./overlay.nix)
];
});
2023-06-03 09:41:41 +00:00
keepBuilt = system: let
pkgs = pkgsFor system {};
in {
inherit (pkgs) nixos-rebuild;
};
2023-06-02 06:29:02 +00:00
in {
inherit (pkgs-unpatched) nixpkgs;
inherit pkgsFor;
2023-06-03 09:41:41 +00:00
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";
2023-06-02 06:29:02 +00:00
}