Skip to content

Instantly share code, notes, and snippets.

@danieldk
Created September 8, 2019 06:29
Show Gist options
  • Save danieldk/2984e65c71e7c0867e528a02194562aa to your computer and use it in GitHub Desktop.
Save danieldk/2984e65c71e7c0867e528a02194562aa to your computer and use it in GitHub Desktop.
diff --git a/crate2nix.nix b/crate2nix.nix
index bca75df..9e0d364 100644
--- a/crate2nix.nix
+++ b/crate2nix.nix
@@ -178,6 +178,7 @@ rec {
dependencies = {
"getrandom" = {
packageId = "getrandom 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)";
+ rename = "getrandom_package";
optional = true;
};
"libc" = {
@@ -382,7 +383,11 @@ rec {
dependencyDerivations buildByPackageId features (crateConfig.dependencies or {});
buildDependencies =
dependencyDerivations buildByPackageId features (crateConfig.buildDependencies or {});
- in buildRustCrate (crateConfig // { inherit features dependencies buildDependencies; });
+ dependenciesWithRenames =
+ lib.filterAttrs (n: v: v ? "rename") (crateConfig.dependencies or {});
+ crateRenames =
+ lib.mapAttrs (name: value: value.rename or name) dependenciesWithRenames;
+ in buildRustCrate (crateConfig // { inherit features dependencies buildDependencies crateRenames; });
in buildByPackageId packageId;
/* Returns the actual derivations for the given dependencies. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment