git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commitc610f99d8fc25dbdcd8530aca17a838c32ac569f authortilpner <till@hoeppner.ws> dateWed 14 Jun 2017, 23:36 (9 years ago) parent46427b7
3 files changed+16−22
pkgs/build-support/rust/default.nix+6−1 pkgs/top-level/all-packages.nix−3 pkgs/top-level/rust-packages.nix+10−18
pkgs/build-support/rust/default.nix+6−1
@@ -1,4 +1,4 @@
1−{ stdenv, cacert, git, rust, rustRegistry }:
1+{ stdenv, callPackage, path, cacert, git, rust }:
22{ name, depsSha256
33, src ? null
44, srcs ? null
@@ -8,9 +8,14 @@
88, cargoUpdateHook ? ""
99, cargoDepsHook ? ""
1010, cargoBuildFlags ? []
11+, registry ? null
1112, ... } @ args:
1213
1314let
15+ lib = stdenv.lib;
16+ rustRegistry = callPackage (path + /pkgs/top-level/rust-packages.nix)
17+ (lib.optionalAttrs (registry != null) { src = registry; });
18+
1419 fetchDeps = import ./fetchcargo.nix {
1520 inherit stdenv cacert git rust rustRegistry;
1621 };
pkgs/top-level/all-packages.nix−3
@@ -5795,7 +5795,6 @@ with pkgs;
57955795 rustNightlyBin = lowPrio (callPackage ../development/compilers/rust/nightlyBin.nix {
57965796 buildRustPackage = callPackage ../build-support/rust {
57975797 rust = rustNightlyBin;
5798− rustRegistry = callPackage ./rust-packages.nix { };
57995798 };
58005799 });
58015800
@@ -5812,8 +5811,6 @@ with pkgs;
58125811 in {
58135812 inherit rust;
58145813
5815− rustRegistry = callPackage ./rust-packages.nix { };
5816−
58175814 buildRustPackage = callPackage ../build-support/rust {
58185815 inherit rust;
58195816 };
pkgs/top-level/rust-packages.nix+10−18
@@ -4,24 +4,16 @@
44# version that we define here. If you're having problems downloading / finding
55# a Rust library, try updating this to a newer commit.
66
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; } ''
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; } ''
2517 # For some reason, cargo doesn't like fetchgit's git repositories, not even
2618 # if we set leaveDotGit to true, set the fetchgit branch to 'master' and clone
2719 # the repository (tested with registry rev