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:
parent
f60bd3ade9
commit
b02c67961f
41
flake.nix
41
flake.nix
@ -150,6 +150,7 @@
|
|||||||
|
|
||||||
perSystem = {
|
perSystem = {
|
||||||
config,
|
config,
|
||||||
|
system,
|
||||||
pkgs,
|
pkgs,
|
||||||
self',
|
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 = {
|
devShells = {
|
||||||
ci = pkgs.mkShell {
|
ci = pkgs.mkShell {
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user