Skip to content

Commit 992e452

Browse files
committed
fix: respect fetchurl passed via top-level Cargo.nix
This seems to be an overlook. `fetchurl` for registries is using the one from function argument, and falls back to `pkgs.fetchurl`. This PR makes fetches for `.crate` tarballs aligned.
1 parent be31fea commit 992e452

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

crate2nix/Cargo.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -3546,7 +3546,7 @@ rec {
35463546
crateConfig
35473547
// {
35483548
src =
3549-
crateConfig.src or (pkgs.fetchurl rec {
3549+
crateConfig.src or (fetchurl rec {
35503550
name = "${crateConfig.crateName}-${crateConfig.version}.tar.gz";
35513551
# https://www.pietroalbini.org/blog/downloading-crates-io/
35523552
# Not rate-limited, CDN URL.

crate2nix/templates/nix/crate2nix/default.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# crate2nix/default.nix (excerpt start)
33
#{#
44
{ pkgs
5+
, fetchurl
56
, lib
67
, stdenv
78
, buildRustCrate
@@ -417,7 +418,7 @@ rec {
417418
crateConfig
418419
// {
419420
src =
420-
crateConfig.src or (pkgs.fetchurl rec {
421+
crateConfig.src or (fetchurl rec {
421422
name = "${crateConfig.crateName}-${crateConfig.version}.tar.gz";
422423
# https://www.pietroalbini.org/blog/downloading-crates-io/
423424
# Not rate-limited, CDN URL.

sample_projects/bin_with_git_submodule_dep/Cargo.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -1764,7 +1764,7 @@ rec {
17641764
crateConfig
17651765
// {
17661766
src =
1767-
crateConfig.src or (pkgs.fetchurl rec {
1767+
crateConfig.src or (fetchurl rec {
17681768
name = "${crateConfig.crateName}-${crateConfig.version}.tar.gz";
17691769
# https://www.pietroalbini.org/blog/downloading-crates-io/
17701770
# Not rate-limited, CDN URL.

sample_projects/codegen/Cargo.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ rec {
939939
crateConfig
940940
// {
941941
src =
942-
crateConfig.src or (pkgs.fetchurl rec {
942+
crateConfig.src or (fetchurl rec {
943943
name = "${crateConfig.crateName}-${crateConfig.version}.tar.gz";
944944
# https://www.pietroalbini.org/blog/downloading-crates-io/
945945
# Not rate-limited, CDN URL.

sample_projects/sub_dir_crates/Cargo.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ rec {
548548
crateConfig
549549
// {
550550
src =
551-
crateConfig.src or (pkgs.fetchurl rec {
551+
crateConfig.src or (fetchurl rec {
552552
name = "${crateConfig.crateName}-${crateConfig.version}.tar.gz";
553553
# https://www.pietroalbini.org/blog/downloading-crates-io/
554554
# Not rate-limited, CDN URL.

0 commit comments

Comments
 (0)