mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-21 16:11:37 +01:00
perf(nix): the overlays share one nixpkgs and one crane build per system
overlays.linux and overlays.forVmTests (which applies the first as well) ran mkPkgs, a new `import nixpkgs` with the rust overlay, and the whole crane mkKomorebiPackages once for every NixOS system an evaluation instantiated: every node of every VM suite and every module scenario, twice each. lib.mkPkgs now hands out one instance per system and the linux module builds the packages of each Linux system once (buildFor). The derivations are the same (drvPath of linux-clippy, vm-kwin and linux-run-kde equal to those before). Measured on a scratch copy of the same change: the stand-alone expression of 4 suites 2.15 -> 1.50 GB, 8 real suites 5.18 -> 4.79 GB, linux-nixos-module-eval 10.3 -> 8.5 GB, plasma guests 9.0 -> 8.7 GB. It does not make the heavy sets cheap: see docs/dev/flake-checks.md.
This commit is contained in:
1 parent
c0980f1f0b
commit
5961368c7d
2 files changed
+21
-8
No files matched your search
+12
-6
@@ -56,10 +56,16 @@ rec {
|
||||
};
|
||||
|
||||
# nixpkgs with the rust overlay, for a system (x86_64-darwin: see the input nixpkgs-x86_64-darwin)
|
||||
mkPkgs =
|
||||
system:
|
||||
import (if system == "x86_64-darwin" then inputs.nixpkgs-x86_64-darwin else inputs.nixpkgs) {
|
||||
inherit system;
|
||||
overlays = [ (import inputs.rust-overlay) ];
|
||||
};
|
||||
mkPkgs = system: pkgsOf.${system};
|
||||
pkgsOf = builtins.listToAttrs (
|
||||
map (system: {
|
||||
name = system;
|
||||
value =
|
||||
import (if system == "x86_64-darwin" then inputs.nixpkgs-x86_64-darwin else inputs.nixpkgs)
|
||||
{
|
||||
inherit system;
|
||||
overlays = [ (import inputs.rust-overlay) ];
|
||||
};
|
||||
}) (windowsSystems ++ linuxSystems ++ macosSystems)
|
||||
);
|
||||
}
|
||||
@@ -12,6 +12,13 @@ let
|
||||
inherit (inputs) nixpkgs;
|
||||
linux = import ./build.nix { inherit inputs self; };
|
||||
inherit (lib') mkPkgs;
|
||||
# The packages of each system, built from one nixpkgs instance: the overlays below run once for every
|
||||
# NixOS system an evaluation instantiates (every node of every VM suite, every module scenario), and
|
||||
# each run would import nixpkgs and build the crane derivations again. The same derivations, but
|
||||
# an evaluation that has all the suites holds one copy of them: see docs/dev/flake-checks.md.
|
||||
buildFor = lib.genAttrs lib'.linuxCheckSystems (
|
||||
system: linux.mkKomorebiPackages { pkgs = mkPkgs system; }
|
||||
);
|
||||
in
|
||||
{
|
||||
perSystem =
|
||||
@@ -383,7 +390,7 @@ in
|
||||
overlays.linux =
|
||||
final: _:
|
||||
let
|
||||
build = linux.mkKomorebiPackages { pkgs = mkPkgs final.stdenv.hostPlatform.system; };
|
||||
build = buildFor.${final.stdenv.hostPlatform.system};
|
||||
in
|
||||
{
|
||||
inherit (build) komorebi komorebic;
|
||||
@@ -396,7 +403,7 @@ in
|
||||
overlays.forVmTests =
|
||||
final: prev:
|
||||
let
|
||||
build = linux.mkKomorebiPackages { pkgs = mkPkgs final.stdenv.hostPlatform.system; };
|
||||
build = buildFor.${final.stdenv.hostPlatform.system};
|
||||
in
|
||||
(self.overlays.linux final prev)
|
||||
// {
|
||||
|
||||
Reference in new issue
Block a user