git.iko.soy/typeable/nixpkgs
on master help sign in
rustRegistry: switch to mkDerivation

fixes #26582

commit7a10cc84a0cd532c8a248d26dedf61d15615fb4d authorJörg Thalheim <joerg@thalheim.io> dateThu 15 Jun 2017, 22:12 (9 years ago) parentc610f99
3 files changed+46−38
pkgs/build-support/rust/default.nix+6−4 pkgs/top-level/all-packages.nix+2 pkgs/top-level/rust-packages.nix+38−34
pkgs/build-support/rust/default.nix+6−4
@@ -1,5 +1,10 @@
1−{ stdenv, callPackage, path, cacert, git, rust }:
1+{ stdenv, callPackage, path, cacert, git, rust, rustRegistry }:
2+
3+let
4+ rustRegistry' = rustRegistry;
5+in
26{ name, depsSha256
7+, rustRegistry ? rustRegistry'
38, src ? null
49, srcs ? null
510, sourceRoot ? null
@@ -8,13 +13,10 @@
813, cargoUpdateHook ? ""
914, cargoDepsHook ? ""
1015, cargoBuildFlags ? []
11−, registry ? null
1216, ... } @ args:
1317
1418let
1519 lib = stdenv.lib;
16− rustRegistry = callPackage (path + /pkgs/top-level/rust-packages.nix)
17− (lib.optionalAttrs (registry != null) { src = registry; });
1820
1921 fetchDeps = import ./fetchcargo.nix {
2022 inherit stdenv cacert git rust rustRegistry;
pkgs/top-level/all-packages.nix+2
@@ -5777,6 +5777,8 @@ with pkgs;
57775777 inherit (darwin) apple_sdk;
57785778 };
57795779
5780+ rustRegistry = callPackage ./rust-packages.nix { };
5781+
57805782 rust = rustStable;
57815783 rustStable = callPackage ../development/compilers/rust {
57825784 inherit (llvmPackages_4) llvm;
pkgs/top-level/rust-packages.nix+38−34
@@ -4,39 +4,43 @@
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−, src ? fetchFromGitHub {
7+{ stdenv, fetchFromGitHub, git }:
8+
9+stdenv.mkDerivation {
10+ name = "rustRegistry-2017-06-25";
11+
12+ src = fetchFromGitHub {
913 owner = "rust-lang";
1014 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
20− # 965b634156cc5c6f10c7a458392bfd6f27436e7e), failing with the message:
21− #
22− # "Target OID for the reference doesn't exist on the repository"
23− #
24− # So we'll just have to create a new git repository from scratch with the
25− # contents downloaded with fetchgit...
26−
27− mkdir -p $out
28−
29− cp -r ${src}/* $out/
30−
31− cd $out
32−
33− git="${git}/bin/git"
34−
35− $git init
36− $git config --local user.email "example@example.com"
37− $git config --local user.name "example"
38− $git add .
39− $git commit --quiet -m 'Rust registry commit'
40−
41− touch $out/touch . "$out/.cargo-index-lock"
42−''
15+ rev = "9714616bf3b7836cb827d8d1eabef017d730fb5e";
16+ sha256 = "02lpmjsqwa16j14y3jzgw4dpzfy001nfyi78x9b8rgp1w3qdjbkr";
17+ };
18+ phases = [ "unpackPhase" "installPhase" ];
19+ installPhase = ''
20+ # For some reason, cargo doesn't like fetchgit's git repositories, not even
21+ # if we set leaveDotGit to true, set the fetchgit branch to 'master' and clone
22+ # the repository (tested with registry rev
23+ # 965b634156cc5c6f10c7a458392bfd6f27436e7e), failing with the message:
24+ #
25+ # "Target OID for the reference doesn't exist on the repository"
26+ #
27+ # So we'll just have to create a new git repository from scratch with the
28+ # contents downloaded with fetchgit...
29+
30+ mkdir -p $out
31+
32+ cp -r ./* $out/
33+
34+ cd $out
35+
36+ git="${git}/bin/git"
37+
38+ $git init
39+ $git config --local user.email "example@example.com"
40+ $git config --local user.name "example"
41+ $git add .
42+ $git commit --quiet -m 'Rust registry commit'
43+
44+ touch $out/touch . "$out/.cargo-index-lock"
45+ '';
46+}