mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-23 08:54:16 +01:00
perf(nix): keep the dependency derivations independent of the source files
cargoLock, cargoToml and the vendor directory of the three flakes were taken
as "${real}/Cargo.lock" and crane.vendorCargoDeps { src = real; }. A string
that names a file inside the filtered source carries the whole source in its
context, so every edit of any file in it (a .rs file, a doc) changed the
dependency derivation (komorebi-workspace-deps, about 1000 crates) and the
dependencies rebuilt on every change: the constant COMMIT_HASH alone did not
help once the stubbed workspace source was introduced.
The lock and the root manifest are now builtins.path copies of those two
files (lockFile, tomlFile) and the vendor directory is made from the lock
(vendorCargoDeps { cargoLock = lockFile; }), so the dependencies depend on
Cargo.lock, Cargo.toml and the manifests the dummy source keeps, as before.
Verified (nix eval of drvPath in a throwaway git copy, three commits:
unchanged tree, an edit of crates/komorebi-config, a docs edit): Windows
deps and kfde deps are identical in all three (before: both changed with any
edit); Windows clippy changes with the source edit and the docs edit (docs are
in the Windows source), kfde clippy and vm stacks change with the
komorebi-config edit only; the kfm deny attribute still evaluates. The kfm
deps and clippy cannot be evaluated on this Linux host (the same change was
made there by analogy). Not built: one cold build, then a second commit must
be a cache hit.
This commit is contained in:
1 parent
219cf65b83
commit
2d6919438b
3 files changed
+43
-12
No files matched your search
@@ -239,12 +239,23 @@
|
||||
isReal = member: !(pkgs.lib.hasPrefix "komorebi-for-" member);
|
||||
};
|
||||
|
||||
lockFile = builtins.path {
|
||||
path = ./Cargo.lock;
|
||||
name = "Cargo.lock";
|
||||
};
|
||||
tomlFile = builtins.path {
|
||||
path = ./Cargo.toml;
|
||||
name = "Cargo.toml";
|
||||
};
|
||||
|
||||
commonArgs = {
|
||||
inherit src version;
|
||||
cargoLock = "${real}/Cargo.lock";
|
||||
cargoToml = "${real}/Cargo.toml";
|
||||
# vendored from the filtered source, not the stubbed one: no build is needed to evaluate
|
||||
cargoVendorDir = craneLib.vendorCargoDeps { src = real; };
|
||||
# the lock and the root manifest as files of their own: a path inside the filtered source would put the
|
||||
# whole filtered source into the context of every derivation, and then an edit of any file
|
||||
# would change the dependencies
|
||||
cargoLock = lockFile;
|
||||
cargoToml = tomlFile;
|
||||
cargoVendorDir = craneLib.vendorCargoDeps { cargoLock = lockFile; };
|
||||
strictDeps = true;
|
||||
# applications.json is committed now; this copies the pinned asc input over it, so that the
|
||||
# embedded file is the pinned one even when the committed copy is older
|
||||
|
||||
@@ -145,14 +145,24 @@
|
||||
|| member == "komorebi-daemon"
|
||||
|| builtins.any (crate: member == crate || pkgs.lib.hasPrefix "${crate}/" member) rootCrates;
|
||||
};
|
||||
lockFile = builtins.path {
|
||||
path = repoRoot + "/Cargo.lock";
|
||||
name = "Cargo.lock";
|
||||
};
|
||||
tomlFile = builtins.path {
|
||||
path = repoRoot + "/Cargo.toml";
|
||||
name = "Cargo.toml";
|
||||
};
|
||||
packages = "-p komorebi -p komorebi-linux -p komorebic -p komorebi-client -p komorebi-hotkeys";
|
||||
workspaceArgs = {
|
||||
pname = "komorebi-workspace";
|
||||
version = (builtins.fromTOML (builtins.readFile ./komorebi/Cargo.toml)).package.version;
|
||||
cargoLock = "${real}/Cargo.lock";
|
||||
cargoToml = "${real}/Cargo.toml";
|
||||
# vendored from the filtered source, not the stubbed one: no build is needed to evaluate
|
||||
cargoVendorDir = craneLib.vendorCargoDeps { src = real; };
|
||||
# the lock and the root manifest as files of their own: a path inside the filtered source
|
||||
# would put all of it into the context of every derivation, and an edit of any file
|
||||
# would then change the dependencies
|
||||
cargoLock = lockFile;
|
||||
cargoToml = tomlFile;
|
||||
cargoVendorDir = craneLib.vendorCargoDeps { cargoLock = lockFile; };
|
||||
};
|
||||
|
||||
commonArgs = workspaceArgs // {
|
||||
|
||||
@@ -129,14 +129,24 @@
|
||||
|| member == "komorebi-bar"
|
||||
|| builtins.any (crate: member == crate || pkgs.lib.hasPrefix "${crate}/" member) rootCrates;
|
||||
};
|
||||
lockFile = builtins.path {
|
||||
path = repoRoot + "/Cargo.lock";
|
||||
name = "Cargo.lock";
|
||||
};
|
||||
tomlFile = builtins.path {
|
||||
path = repoRoot + "/Cargo.toml";
|
||||
name = "Cargo.toml";
|
||||
};
|
||||
packages = "-p komorebi -p komorebi-macos -p komorebic -p komorebi-client -p komorebi-bar";
|
||||
workspaceArgs = {
|
||||
pname = "komorebi-workspace";
|
||||
inherit version;
|
||||
cargoLock = "${real}/Cargo.lock";
|
||||
cargoToml = "${real}/Cargo.toml";
|
||||
# vendored from the filtered source, not the stubbed one: no build is needed to evaluate
|
||||
cargoVendorDir = craneLib.vendorCargoDeps { src = real; };
|
||||
# the lock and the root manifest as files of their own: a path inside the filtered source
|
||||
# would put all of it into the context of every derivation, and an edit of any file
|
||||
# would then change the dependencies
|
||||
cargoLock = lockFile;
|
||||
cargoToml = tomlFile;
|
||||
cargoVendorDir = craneLib.vendorCargoDeps { cargoLock = lockFile; };
|
||||
};
|
||||
|
||||
commonArgs = workspaceArgs // {
|
||||
|
||||
Reference in new issue
Block a user