Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git dependencies with [patch.crates-io] #152

Closed
jD91mZM2 opened this issue Feb 18, 2021 · 3 comments
Closed

Git dependencies with [patch.crates-io] #152

jD91mZM2 opened this issue Feb 18, 2021 · 3 comments

Comments

@jD91mZM2
Copy link
Member

jD91mZM2 commented Feb 18, 2021

Unfortunately, git dependencies in [patch.crates-io] aren't taken into account.

You can test it out on this branch of rnix-lsp. (There is a default.nix which uses flake-compat if you're not a user of nix flakes)

It's apparently not as simple as the following diff, otherwise I would have opened a PR. That seems to cause some issue where cargo thinks the lock file is out-of-date - very strange indeed.

diff --git a/lib.nix b/lib.nix
index c395c95..57f8245 100644
--- a/lib.nix
+++ b/lib.nix
@@ -81,7 +81,8 @@ rec
       let
       tomlDependencies = cargotoml:
         lib.filter (x: ! isNull x) (
-          lib.mapAttrsToList
+          lib.flip lib.mapAttrsToList
+            ((cargotoml.dependencies or { }) // (cargotoml.patch.crates-io or {}))
             (k: v:
               if ! (lib.isAttrs v && builtins.hasAttr "git" v)
               then null
@@ -115,7 +116,8 @@ rec
                     ref = val.tag;
                   });
                 }
-            ) cargotoml.dependencies or { });
+            )
+        );
       in
         lib.mapAttrs (_: tomlDependencies) cargotomls;
 
@LEXUGE
Copy link

LEXUGE commented Mar 13, 2021

Same issue here

@yusdacra
Copy link
Member

yusdacra@5a0df99 this commit fixes that I believe. Veloren also uses [patch.crates-io], and with that commit it works fine.

jwoudenberg added a commit to jwoudenberg/elm-pair that referenced this issue Jan 12, 2022
Without this the Nix build is currently failing, because the stable
naersk has a bug related to using git dependencies in crate overrides,
see:

nix-community/naersk#152

Fixing to the naersk in this PR fixed things:

nix-community/naersk#167

This should be a short-lived changed. I hope to either get my PR for the
abomonation library merged which would make the crate override
unnecessary. Should it not get merged I'll likely abandon my abomonation
fork for some alternative solution.
jwoudenberg added a commit to jwoudenberg/elm-pair that referenced this issue Jan 17, 2022
Without this the Nix build is currently failing, because the stable
naersk has a bug related to using git dependencies in crate overrides,
see:

nix-community/naersk#152

Fixing to the naersk in this PR fixed things:

nix-community/naersk#167

This should be a short-lived changed. I hope to either get my PR for the
abomonation library merged which would make the crate override
unnecessary. Should it not get merged I'll likely abandon my abomonation
fork for some alternative solution.
@Patryk27
Copy link
Contributor

This should be fixed now that we have #231 merged.

Please feel free to re-open this ticket if the issue still appears 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants