Skip to content

Commit

Permalink
Fix patched git dependancies
Browse files Browse the repository at this point in the history
  • Loading branch information
marius851000 authored and yusdacra committed Mar 14, 2021
1 parent e0fe990 commit 5a0df99
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ let
)
);

patchedGit = if (builtins.hasAttr "patch" toplevelCargotoml) then (
(lib.filterAttrs (n: v: v ? "git")
toplevelCargotoml.patch.crates-io)
) else {};

# Are we building a workspace (or is this a simple crate) ?
isWorkspace = builtins.hasAttr "workspace" toplevelCargotoml;

Expand Down
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let
let
config = mkConfig arg;
gitDependencies =
libb.findGitDependencies { inherit (config) cargotomls cargolock; };
libb.findGitDependencies { inherit (config) cargotomls cargolock patchedGit; };
cargoconfig =
if builtinz.pathExists (toString config.root + "/.cargo/config")
then builtins.readFile (config.root + "/.cargo/config")
Expand Down
8 changes: 7 additions & 1 deletion lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,18 @@ rec
findGitDependencies =
{ cargotomls
, cargolock
, patchedGit
}:
let
tomlDependencies = cargotoml:
lib.filter (x: ! isNull x) (
lib.mapAttrsToList
(k: v:
(k: unpatched:
let
v = (if patchedGit ? "${k}" then
patchedGit."${k}"
else unpatched);
in
if ! (lib.isAttrs v && builtins.hasAttr "git" v)
then null
else
Expand Down

0 comments on commit 5a0df99

Please sign in to comment.