mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 22:01:22 +01:00
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.
72 lines
2.4 KiB
Nix
72 lines
2.4 KiB
Nix
# Helpers shared by the platform modules of the flake.
|
|
{ inputs }:
|
|
rec {
|
|
# the repository, as the source of the flake
|
|
repoRoot = ./..;
|
|
|
|
# a file or directory of the repository as a store path of its own: `./tools/format-all` would name
|
|
# a place in the store path of the whole flake source, which changes with every edit of the
|
|
# repository and so would rebuild the derivation that reads it
|
|
repoFile =
|
|
rel:
|
|
builtins.path {
|
|
path = repoRoot + "/${rel}";
|
|
name = builtins.baseNameOf rel;
|
|
};
|
|
|
|
# the version of the workspace: every package says `version.workspace = true`
|
|
version =
|
|
(builtins.fromTOML (builtins.readFile (repoRoot + "/Cargo.toml"))).workspace.package.version;
|
|
|
|
# the systems that cross-build for Windows, build the Linux packages and build the macOS packages
|
|
windowsSystems = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"aarch64-darwin"
|
|
];
|
|
linuxSystems = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
];
|
|
# Apple silicon also gets the checks of the KDE crates (they run against a fake desktop)
|
|
linuxCheckSystems = linuxSystems ++ [ "aarch64-darwin" ];
|
|
macosSystems = [
|
|
"aarch64-darwin"
|
|
"x86_64-darwin"
|
|
];
|
|
|
|
# The manifests (Cargo.toml, Cargo.lock, build scripts, .cargo/config.toml) of every member of the
|
|
# workspace, of all three platforms, and nothing else: crane makes the dummy source of the dependency
|
|
# derivations from it. A pure path (no derivation), so that crane reads it at evaluation without
|
|
# building anything, which `nix flake check --all-systems` needs on a host that cannot build for the
|
|
# other systems; and the same for every platform, so that the dependencies do not depend on the stubs.
|
|
manifestSource =
|
|
lib:
|
|
lib.fileset.toSource {
|
|
root = repoRoot;
|
|
fileset = lib.fileset.fileFilter (
|
|
file:
|
|
builtins.elem file.name [
|
|
"Cargo.toml"
|
|
"Cargo.lock"
|
|
"build.rs"
|
|
"config.toml"
|
|
]
|
|
) repoRoot;
|
|
};
|
|
|
|
# nixpkgs with the rust overlay, for a system (x86_64-darwin: see the input nixpkgs-x86_64-darwin)
|
|
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)
|
|
);
|
|
}
|