allow overwriting cargo toml/lock location

This commit is contained in:
Robin Appelman 2025-06-09 16:24:04 +02:00
commit 8a5baa8225
2 changed files with 30 additions and 9 deletions

View file

@ -2,16 +2,17 @@
lib,
src,
config,
cargoLock,
}: let
inherit (builtins) readFile pathExists attrNames hasAttr;
inherit (lib) map intersectLists foldl splitString getAttrFromPath;
cargoLockDeps =
if pathExists (src + /Cargo.lock)
if pathExists cargoLock
then let
cargoLock = fromTOML (readFile (src + /Cargo.lock));
cargoLockToml = fromTOML (readFile cargoLock);
in
map (package: package.name) cargoLock.package
map (package: package.name) cargoLockToml.package
else [];
availableAutoDeps = import ./deps.nix;
detectedDeps = intersectLists cargoLockDeps (attrNames availableAutoDeps);