diff --git a/config.nix b/config.nix index c412f87..3a1b09c 100644 --- a/config.nix +++ b/config.nix @@ -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; diff --git a/default.nix b/default.nix index 2aa3cee..2f98306 100644 --- a/default.nix +++ b/default.nix @@ -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") diff --git a/lib.nix b/lib.nix index 6dda21f..0884987 100644 --- a/lib.nix +++ b/lib.nix @@ -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