Expose custom Rust registry versions

This allows users to specify a custom registry src,
because currently every packager would need to create
an outdated Cargo.lock just to be compatible with the
probably outdated rustRegistry in nixpkgs.

Currently there is no easy way to convince cargo to
do that, so this makes that workaround unnecessary.

authored by tilpner and committed by Jörg Thalheim c610f99d 46427b77

+15 -21
+6 -1
pkgs/build-support/rust/default.nix
··· 1 - { stdenv, cacert, git, rust, rustRegistry }: 2 { name, depsSha256 3 , src ? null 4 , srcs ? null ··· 8 , cargoUpdateHook ? "" 9 , cargoDepsHook ? "" 10 , cargoBuildFlags ? [] 11 , ... } @ args: 12 13 let 14 fetchDeps = import ./fetchcargo.nix { 15 inherit stdenv cacert git rust rustRegistry; 16 };
··· 1 + { stdenv, callPackage, path, cacert, git, rust }: 2 { name, depsSha256 3 , src ? null 4 , srcs ? null ··· 8 , cargoUpdateHook ? "" 9 , cargoDepsHook ? "" 10 , cargoBuildFlags ? [] 11 + , registry ? null 12 , ... } @ args: 13 14 let 15 + lib = stdenv.lib; 16 + rustRegistry = callPackage (path + /pkgs/top-level/rust-packages.nix) 17 + (lib.optionalAttrs (registry != null) { src = registry; }); 18 + 19 fetchDeps = import ./fetchcargo.nix { 20 inherit stdenv cacert git rust rustRegistry; 21 };
-3
pkgs/top-level/all-packages.nix
··· 5795 rustNightlyBin = lowPrio (callPackage ../development/compilers/rust/nightlyBin.nix { 5796 buildRustPackage = callPackage ../build-support/rust { 5797 rust = rustNightlyBin; 5798 - rustRegistry = callPackage ./rust-packages.nix { }; 5799 }; 5800 }); 5801 ··· 5811 callPackage = newScope self; 5812 in { 5813 inherit rust; 5814 - 5815 - rustRegistry = callPackage ./rust-packages.nix { }; 5816 5817 buildRustPackage = callPackage ../build-support/rust { 5818 inherit rust;
··· 5795 rustNightlyBin = lowPrio (callPackage ../development/compilers/rust/nightlyBin.nix { 5796 buildRustPackage = callPackage ../build-support/rust { 5797 rust = rustNightlyBin; 5798 }; 5799 }); 5800 ··· 5810 callPackage = newScope self; 5811 in { 5812 inherit rust; 5813 5814 buildRustPackage = callPackage ../build-support/rust { 5815 inherit rust;
+9 -17
pkgs/top-level/rust-packages.nix
··· 4 # version that we define here. If you're having problems downloading / finding 5 # a Rust library, try updating this to a newer commit. 6 7 - { runCommand, fetchFromGitHub, git }: 8 - 9 - let 10 - version = "2017-06-16"; 11 - rev = "cda0f689f844710a3d73c7ff459efa64997f73b5"; 12 - sha256 = "1b3brl9nn3qqaysd8lx9gaazd863grqx547iw7y9j6mkcc7sakvc"; 13 - 14 - src = fetchFromGitHub { 15 - inherit rev; 16 - inherit sha256; 17 - 18 - owner = "rust-lang"; 19 - repo = "crates.io-index"; 20 - }; 21 - 22 - in 23 24 - runCommand "rustRegistry-${version}-${builtins.substring 0 7 rev}" { inherit src; } '' 25 # For some reason, cargo doesn't like fetchgit's git repositories, not even 26 # if we set leaveDotGit to true, set the fetchgit branch to 'master' and clone 27 # the repository (tested with registry rev
··· 4 # version that we define here. If you're having problems downloading / finding 5 # a Rust library, try updating this to a newer commit. 6 7 + { runCommand, fetchFromGitHub, git 8 + , src ? fetchFromGitHub { 9 + owner = "rust-lang"; 10 + repo = "crates.io-index"; 11 + rev = "cda0f689f844710a3d73c7ff459efa64997f73b5"; 12 + sha256 = "1b3brl9nn3qqaysd8lx9gaazd863grqx547iw7y9j6mkcc7sakvc"; 13 + } 14 + }: 15 16 + runCommand "rustRegistry" { inherit src; } '' 17 # For some reason, cargo doesn't like fetchgit's git repositories, not even 18 # if we set leaveDotGit to true, set the fetchgit branch to 'master' and clone 19 # the repository (tested with registry rev