diff --git a/flake.nix b/flake.nix index 6433156d..7b867cbe 100644 --- a/flake.nix +++ b/flake.nix @@ -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 diff --git a/komorebi-for-kde/flake.nix b/komorebi-for-kde/flake.nix index ea310c93..13dab98e 100644 --- a/komorebi-for-kde/flake.nix +++ b/komorebi-for-kde/flake.nix @@ -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 // { diff --git a/komorebi-for-mac/flake.nix b/komorebi-for-mac/flake.nix index 4ca2e262..c5009670 100644 --- a/komorebi-for-mac/flake.nix +++ b/komorebi-for-mac/flake.nix @@ -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 // {