Rust: Difference between revisions
imported>A-m-joseph Link to the best example of overriding a rust dependency that I could find. |
imported>A-m-joseph Longer example, fixed the section title |
||
Line 129: | Line 129: | ||
[https://www.srid.ca/rust-nix This] blog post shows how to do it using <code>crate2nix</code>. | [https://www.srid.ca/rust-nix This] blog post shows how to do it using <code>crate2nix</code>. | ||
== | == Using overrideArgs with Rust Packages == | ||
This is a bit tricky, you can't just use <code> | This is a bit tricky, you can't just use <code>overrideArgs</code>. [https://discourse.nixos.org/t/is-it-possible-to-override-cargosha256-in-buildrustpackage/4393/3 Here] is one example of how to do it. The trick is to use two nested calls to <code>overrideAttrs</code>; the outer call overrides the <code>cargoDeps</code> attribute, the inner call overrides the dependency: | ||
<syntaxHighlight lang="nix"> | |||
overlays = [ | |||
(final: prev: { | |||
some-nixpkgs-package = prev.some-nixpkgs-package.overrideAttrs (oldAttrs: { | |||
cargoDeps = oldAttrs.cargoDeps.overrideAttrs (_: { | |||
# ... | |||
}); | |||
}); | |||
}) | |||
]; | |||
</syntaxHighlight> | |||
== Neovim Completion == | == Neovim Completion == |