flake: add config specialisation attrset

This contains each host's individual specialisations as separate
derivations, as well as a modified top-level config containing no
specialisations. Evaluating specialisations as separate derivations
takes significantly less memory (especially since nix-fast-build doesn't
support eval caching) and should stop CI from crashing.
This commit is contained in:
NullBite 2025-03-03 16:25:16 -05:00
parent f60bd3ade9
commit b02c67961f
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A

View File

@ -150,6 +150,7 @@
perSystem = {
config,
system,
pkgs,
self',
...
@ -160,6 +161,46 @@
};
};
legacyPackages.specialisedNixosConfigurations = let
attrs = lib.pipe self.nixosConfigurations [
(lib.filterAttrs (n: v: !(builtins.elem n ["iso" "rpi4-x86_64"])))
(lib.filterAttrs (n: v: v.pkgs.system or "" == system))
(lib.mapAttrs' (configName: v: let
nospec =
(v.extendModules {
modules = [
({lib, ...}: {
# this should NEVER be overridden, hence mkOrder 5
config.specialisation = lib.mkOrder 5 {};
})
];
})
.config;
configs =
(
lib.mapAttrs'
(n: v: lib.nameValuePair "specialisation-${n}" v.configuration)
v.config.specialisation
)
// {inherit nospec;};
in
lib.nameValuePair configName configs))
(
lib.concatMapAttrs (
configName: v:
(
lib.mapAttrs' (
specName: v: lib.nameValuePair "${configName}--${specName}" v
)
)
v
)
)
(lib.mapAttrs (_: v: v.system.build.toplevel))
];
in
attrs;
devShells = {
ci = pkgs.mkShell {
buildInputs = with pkgs; [