mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-04 20:22:14 +03:00
fix: make cargo-lock translator handle discovered project path deps seperately, handle store path source paths correctly
This commit is contained in:
parent
1cca528ec6
commit
07c7d7d2dc
@ -12,18 +12,18 @@
|
||||
sources,
|
||||
...
|
||||
}: let
|
||||
b = builtins;
|
||||
l = lib // builtins;
|
||||
|
||||
fetchedSources =
|
||||
lib.mapAttrs
|
||||
l.mapAttrs
|
||||
(name: versions:
|
||||
lib.mapAttrs
|
||||
l.mapAttrs
|
||||
(version: source:
|
||||
if source.type == "unknown"
|
||||
then "unknown"
|
||||
else if source.type == "path"
|
||||
then
|
||||
if lib.isStorePath source.path
|
||||
if l.isStorePath (l.concatStringsSep "/" (l.take 4 (l.splitString "/" source.path)))
|
||||
then source.path
|
||||
else if name == source.rootName && version == source.rootVersion
|
||||
then throw "source for ${name}@${version} is referencing itself"
|
||||
@ -43,7 +43,7 @@
|
||||
sources;
|
||||
|
||||
overriddenSources =
|
||||
lib.recursiveUpdateUntil
|
||||
l.recursiveUpdateUntil
|
||||
(path: l: r: lib.isDerivation l)
|
||||
fetchedSources
|
||||
(sourceOverrides fetchedSources);
|
||||
|
@ -239,12 +239,12 @@ in {
|
||||
# source definition containing url, hash, etc.
|
||||
sourceConstructors = {
|
||||
path = dependencyObject: let
|
||||
toml = (
|
||||
findToml =
|
||||
l.findFirst
|
||||
(toml: toml.value.package.name == dependencyObject.name)
|
||||
(throw "could not find crate ${dependencyObject.name}")
|
||||
(cargoPackages ++ discoveredCargoPackages)
|
||||
);
|
||||
null;
|
||||
toml = findToml cargoPackages;
|
||||
discoveredToml = findToml discoveredCargoPackages;
|
||||
relDir = lib.removePrefix "${inputDir}/" (l.dirOf toml.path);
|
||||
in
|
||||
if
|
||||
@ -257,12 +257,21 @@ in {
|
||||
rootName = null;
|
||||
rootVersion = null;
|
||||
}
|
||||
else
|
||||
else if discoveredToml != null
|
||||
then
|
||||
dlib.construct.pathSource {
|
||||
path = l.dirOf discoveredToml.path;
|
||||
rootName = null;
|
||||
rootVersion = null;
|
||||
}
|
||||
else if toml != null
|
||||
then
|
||||
dlib.construct.pathSource {
|
||||
path = relDir;
|
||||
rootName = package.name;
|
||||
rootVersion = package.version;
|
||||
};
|
||||
}
|
||||
else throw "could not find crate ${dependencyObject.name}";
|
||||
|
||||
git = dependencyObject: let
|
||||
parsed = parseGitSource dependencyObject.source;
|
||||
|
Loading…
Reference in New Issue
Block a user