summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorKevin Cox <kevincox@kevincox.ca>2017-08-05 15:38:48 +0100
committerzimbatm <zimbatm@zimbatm.com>2017-10-23 00:30:47 +0100
commit5f8cf0048ea089fa73d17512fc4f9f0f0644e225 (patch)
tree7a9bfc449fab89da9af7b012d4b55ea809eb102d /pkgs
parentd170c2ceadde34a1ee4844fe59d876351331b707 (diff)
downloadnixlib-5f8cf0048ea089fa73d17512fc4f9f0f0644e225.tar
nixlib-5f8cf0048ea089fa73d17512fc4f9f0f0644e225.tar.gz
nixlib-5f8cf0048ea089fa73d17512fc4f9f0f0644e225.tar.bz2
nixlib-5f8cf0048ea089fa73d17512fc4f9f0f0644e225.tar.lz
nixlib-5f8cf0048ea089fa73d17512fc4f9f0f0644e225.tar.xz
nixlib-5f8cf0048ea089fa73d17512fc4f9f0f0644e225.tar.zst
nixlib-5f8cf0048ea089fa73d17512fc4f9f0f0644e225.zip
rust: update cargo builder to fetch registry dynamically
The biggest benefit is that we no longer have to update the registry
package. This means that just about any cargo package can be built by
nix. No longer does `cargo update` need to be feared because it will
update to packages newer then what is available in nixpkgs.

Instead of fetching the cargo registry this bundles all the source code
into a "vendor/" folder.

This also uses the new --frozen and --locked flags which is nice.

Currently cargo-vendor only provides binaries for Linux and
macOS 64-bit. This can be solved by building it for the other
architectures and uploading it somewhere (like the NixOS cache).

This also has the downside that it requires a change to everyone's deps
hash. And if the old one is used because it was cached it will fail to
build as it will attempt to use the old version. For this reason the
attribute has been renamed to `cargoSha256`.

Authors:
* Kevin Cox <kevincox@kevincox.ca>
* Jörg Thalheim <Mic92@users.noreply.github.com>
* zimbatm <zimbatm@zimbatm.com>
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/altcoins/ethabi.nix2
-rw-r--r--pkgs/applications/altcoins/ethrun.nix3
-rw-r--r--pkgs/applications/altcoins/zcash/librustzcash/default.nix2
-rw-r--r--pkgs/applications/misc/alacritty/default.nix3
-rw-r--r--pkgs/applications/networking/cluster/habitat/default.nix3
-rw-r--r--pkgs/applications/networking/dyndns/cfdyndns/default.nix2
-rw-r--r--pkgs/applications/version-management/git-and-tools/git-dit/default.nix2
-rw-r--r--pkgs/applications/version-management/pijul/default.nix2
-rwxr-xr-xpkgs/applications/window-managers/way-cooler/default.nix3
-rw-r--r--pkgs/applications/window-managers/wtftw/default.nix3
-rw-r--r--pkgs/build-support/rust/cargo-vendor.nix32
-rw-r--r--pkgs/build-support/rust/default.nix89
-rwxr-xr-xpkgs/build-support/rust/fetch-cargo-deps209
-rw-r--r--pkgs/build-support/rust/fetchcargo.nix25
-rw-r--r--pkgs/development/compilers/rust/cargo.nix4
-rw-r--r--pkgs/development/compilers/rust/default.nix4
-rw-r--r--pkgs/development/compilers/rust/patches/0001-Disable-fragile-tests-libstd-net-tcp-on-Darwin-Linux.patch (renamed from pkgs/development/compilers/rust/patches/darwin-disable-fragile-tcp-tests.patch)31
-rw-r--r--pkgs/development/misc/loc/default.nix8
-rw-r--r--pkgs/development/tools/clog-cli/default.nix2
-rw-r--r--pkgs/development/tools/git-series/default.nix18
-rw-r--r--pkgs/development/tools/misc/tokei/default.nix3
-rw-r--r--pkgs/development/tools/rq/default.nix2
-rw-r--r--pkgs/development/tools/rust/bindgen/default.nix2
-rw-r--r--pkgs/development/tools/rust/racer/default.nix2
-rw-r--r--pkgs/development/tools/rust/racerd/default.nix2
-rw-r--r--pkgs/development/tools/rust/rainicorn/default.nix3
-rw-r--r--pkgs/development/tools/rust/rustfmt/default.nix2
-rw-r--r--pkgs/development/tools/rust/rustup/default.nix2
-rw-r--r--pkgs/misc/tw-rs/default.nix2
-rw-r--r--pkgs/shells/ion/default.nix2
-rw-r--r--pkgs/tools/admin/intecture/agent.nix2
-rw-r--r--pkgs/tools/admin/intecture/auth.nix2
-rw-r--r--pkgs/tools/admin/intecture/cli.nix2
-rw-r--r--pkgs/tools/filesystems/btrfs-dedupe/default.nix2
-rw-r--r--pkgs/tools/misc/exa/default.nix2
-rw-r--r--pkgs/tools/misc/fd/default.nix2
-rw-r--r--pkgs/tools/misc/heatseeker/default.nix2
-rw-r--r--pkgs/tools/package-management/cargo-edit/default.nix3
-rw-r--r--pkgs/tools/package-management/nix-index/default.nix2
-rw-r--r--pkgs/tools/text/ripgrep/default.nix2
-rw-r--r--pkgs/tools/text/staccato/default.nix3
-rw-r--r--pkgs/tools/text/xsv/default.nix2
-rw-r--r--pkgs/tools/typesetting/tectonic/default.nix2
-rw-r--r--pkgs/top-level/aliases.nix1
-rw-r--r--pkgs/top-level/all-packages.nix2
-rw-r--r--pkgs/top-level/rust-packages.nix46
46 files changed, 157 insertions, 389 deletions
diff --git a/pkgs/applications/altcoins/ethabi.nix b/pkgs/applications/altcoins/ethabi.nix
index c584dd65ebb8..e8fb1c49828e 100644
--- a/pkgs/applications/altcoins/ethabi.nix
+++ b/pkgs/applications/altcoins/ethabi.nix
@@ -13,7 +13,7 @@ buildRustPackage rec {
     sha256 = "1rg7ydvnhlg8w6blilm3cv6v4q51x1hgrbkln2ikhpdq0vakp5fd";
   };
 
-  depsSha256 = "1n4rxipna307r4xppb2iaads7kpa3yjv99fimvpn8l0f999ir2rz";
+  cargoSha256 = "0i9617qwc6d4jvlbydwk03rcsnyvxzpbn2ms10ds4r6x7jy2a4sy";
 
   cargoBuildFlags = ["--features cli"];
 
diff --git a/pkgs/applications/altcoins/ethrun.nix b/pkgs/applications/altcoins/ethrun.nix
index f61a5884fd4a..2a8c37610dba 100644
--- a/pkgs/applications/altcoins/ethrun.nix
+++ b/pkgs/applications/altcoins/ethrun.nix
@@ -13,12 +13,13 @@ buildRustPackage rec {
     sha256 = "1w651g4p2mc4ljp20l8lwvfx3l3fzyp6gf2izr85vyb1wjbaccqn";
   };
 
-  depsSha256 = "14x8pbjgkz0g724lnvd9mi2alqd6fipjljw6xsraf9gqwijn1knq";
+  cargoSha256 = "14x8pbjgkz0g724lnvd9mi2alqd6fipjljw6xsraf9gqwijn1kn0";
 
   meta = {
     description = "Directly run Ethereum bytecode";
     homepage = https://github.com/dapphub/ethrun/;
     maintainers = [stdenv.lib.maintainers.dbrock];
+    broken = true; # mark temporary as broken
     inherit version;
   };
 }
diff --git a/pkgs/applications/altcoins/zcash/librustzcash/default.nix b/pkgs/applications/altcoins/zcash/librustzcash/default.nix
index 2b2094c84018..b89582c09e60 100644
--- a/pkgs/applications/altcoins/zcash/librustzcash/default.nix
+++ b/pkgs/applications/altcoins/zcash/librustzcash/default.nix
@@ -11,7 +11,7 @@ rustPlatform.buildRustPackage rec {
     sha256 = "02l1f46frpvw1r6k1wfh77mrsnmsdvifqx0vnscxz4xgb9ia9d1c";
   };
 
-  depsSha256 = "02qx8zdhmj7rmhqqq5q9428x9mlrjxxcnn4yhnygz9gfgvada2hx";
+  cargoSha256 = "1b0kal53ggcr59hbrsdj8fifjycahrmzwq677n9h3fywv4r237m6";
 
   installPhase = ''
     mkdir -p $out/lib
diff --git a/pkgs/applications/misc/alacritty/default.nix b/pkgs/applications/misc/alacritty/default.nix
index 411705e6a6ae..77466fba6530 100644
--- a/pkgs/applications/misc/alacritty/default.nix
+++ b/pkgs/applications/misc/alacritty/default.nix
@@ -38,7 +38,7 @@ buildRustPackage rec {
     sha256 = "0h37x12r33xwz9vf1n8y24c0ph5w17lhkpfi5q6lbpgidvbs6fyx";
   };
 
-  depsSha256 = "05gkl2zg546i2pm0gx11s56f7dk72qpm39kml1d2myj81s0vyb5z";
+  cargoSha256 = "0w3j92kd27pny37pfvlv6qsnbb1lgphmfbhvvng0z96r2b1wjviz";
 
   buildInputs = [
     cmake
@@ -69,6 +69,7 @@ buildRustPackage rec {
   dontPatchELF = true;
 
   meta = with stdenv.lib; {
+    broken = true;
     description = "GPU-accelerated terminal emulator";
     homepage = https://github.com/jwilm/alacritty;
     license = with licenses; [ asl20 ];
diff --git a/pkgs/applications/networking/cluster/habitat/default.nix b/pkgs/applications/networking/cluster/habitat/default.nix
index 605312611404..1656e5a09a6b 100644
--- a/pkgs/applications/networking/cluster/habitat/default.nix
+++ b/pkgs/applications/networking/cluster/habitat/default.nix
@@ -14,7 +14,7 @@ buildRustPackage rec {
     sha256 = "0pqrm85pd9hqn5fwqjbyyrrfh4k7q9mi9qy9hm8yigk5l8mw44y1";
   };
 
-  depsSha256 = "1ahfm5agvabqqqgjsyjb95xxbc7mng1mdyclcakwp1m1qdkxx9py";
+  cargoSha256 = "1ahfm5agvabqqqgjsyjb95xxbc7mng1mdyclcakwp1m1qdkxx9p0";
 
   buildInputs = [ libsodium libarchive openssl ];
 
@@ -35,5 +35,6 @@ buildRustPackage rec {
     license = licenses.asl20;
     maintainers = [ maintainers.rushmorem ];
     platforms = [ "x86_64-linux" "x86_64-darwin" ];
+    broken = true; # mark temporary as broken due git dependencies
   };
 }
diff --git a/pkgs/applications/networking/dyndns/cfdyndns/default.nix b/pkgs/applications/networking/dyndns/cfdyndns/default.nix
index a79404e77c85..d1eeaa48bb7b 100644
--- a/pkgs/applications/networking/dyndns/cfdyndns/default.nix
+++ b/pkgs/applications/networking/dyndns/cfdyndns/default.nix
@@ -12,7 +12,7 @@ buildRustPackage rec {
     sha256 = "1mcdjykrgh0jq6k6y664lai8sbgzk6j7k0r944f43vg63d1jql5b";
   };
 
-  depsSha256 = "0whs3fgmpb6g1mjajs3qs9g613x5dal4x6ghzzkpl73a9pgydkpn";
+  cargoSha256 = "0k9d6pxsb4gvkqs00g71c1nnz773iccg4vajgn33qdym6m6qsjwy";
 
   buildInputs = [ makeWrapper openssl ];
 
diff --git a/pkgs/applications/version-management/git-and-tools/git-dit/default.nix b/pkgs/applications/version-management/git-and-tools/git-dit/default.nix
index d68430714deb..6fb9f5e36f1a 100644
--- a/pkgs/applications/version-management/git-and-tools/git-dit/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/git-dit/default.nix
@@ -23,7 +23,7 @@ buildRustPackage rec {
     sha256 = "1sx6sc2dj3l61gbiqz8vfyhw5w4xjdyfzn1ixz0y8ipm579yc7a2";
   };
 
-  depsSha256 = "1z2n3z5wkh5z5vc976yscq77fgjszwzwlrp7g17hmsbhzx6x170h";
+  cargoSha256 = "08zbvjwjdpv2sbj6mh73py82inhs18jvmh8m9k4l94fcz6ykgqwr";
 
   nativeBuildInputs = [
     cmake
diff --git a/pkgs/applications/version-management/pijul/default.nix b/pkgs/applications/version-management/pijul/default.nix
index a5479a6c6a87..36c7c3c58851 100644
--- a/pkgs/applications/version-management/pijul/default.nix
+++ b/pkgs/applications/version-management/pijul/default.nix
@@ -18,7 +18,7 @@ buildRustPackage rec {
 
   doCheck = false;
 
-  depsSha256 = "1qzzpnkyw1bn5fnj06c80f7985v1q0rqcphrrrkpbi33lg5mzgbv";
+  cargoSha256 = "0r69vghjd6b30v0qjsipyv56n92iwvyxmllrnwjzjf5pzhhjl7sy";
 
   meta = with stdenv.lib; {
     description = "A distributed version control system";
diff --git a/pkgs/applications/window-managers/way-cooler/default.nix b/pkgs/applications/window-managers/way-cooler/default.nix
index d9d84e834304..75c9e6ecf8c8 100755
--- a/pkgs/applications/window-managers/way-cooler/default.nix
+++ b/pkgs/applications/window-managers/way-cooler/default.nix
@@ -14,13 +14,14 @@ buildRustPackage rec {
     sha256 = "10s01x54kwjm2c85v57i6g3pvj5w3wpkjblj036mmd865fla1brb";
   };
 
-  depsSha256 = "1k5xbw2zhm5z650mxdbxixr90im53wlpjdvq2pbnx2snqm84idlc";
+  cargoSha256 = "06qivlybmmc49ksv4232sm1r4hp923xsq4c2ksa4i2azdzc1csdc";
 
   buildInputs = [ wlc dbus_libs dbus_glib cairo libxkbcommon ];
 
   nativeBuildInputs = [ pkgconfig ];
 
   meta = with stdenv.lib; {
+    broken = true;
     description = "Customizable Wayland compositor (window manager)";
     longDescription = ''
       Way Cooler is a customizable tiling window manager written in Rust
diff --git a/pkgs/applications/window-managers/wtftw/default.nix b/pkgs/applications/window-managers/wtftw/default.nix
index 598bd23c1642..a4eff26d88cf 100644
--- a/pkgs/applications/window-managers/wtftw/default.nix
+++ b/pkgs/applications/window-managers/wtftw/default.nix
@@ -9,7 +9,7 @@ rustPlatform.buildRustPackage rec {
     sha256 = "1r74nhcwiy2rmifzjhdal3jcqz4jz48nfvhdyw4gasa6nxp3msdl";
   };
 
-  depsSha256 = "0z7h8ybh2db3xl8qxbzby5lncdaijixzmbn1j8a45lbky1xiix71";
+  cargoSha256 = "0z92ml84b5652zgwzn08a8vvxksaa54jql66sfpdz1mvjwhgdmvn";
 
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ libXinerama libX11 ];
@@ -31,6 +31,7 @@ rustPlatform.buildRustPackage rec {
   '';
 
   meta = with stdenv.lib; {
+    broken = true;
     description = "A tiling window manager in Rust";
     homepage = https://github.com/Kintaro/wtftw;
     license = stdenv.lib.licenses.bsd3;
diff --git a/pkgs/build-support/rust/cargo-vendor.nix b/pkgs/build-support/rust/cargo-vendor.nix
new file mode 100644
index 000000000000..6b50f8b83e73
--- /dev/null
+++ b/pkgs/build-support/rust/cargo-vendor.nix
@@ -0,0 +1,32 @@
+{ fetchurl, stdenv }:
+let
+  inherit (stdenv) system;
+
+  version = "0.1.12";
+
+  hashes = {
+    x86_64-linux = "1hxlavcxy374yypfamlkygjg662lhll8j434qcvdawkvlidg5ii5";
+    x86_64-darwin = "1jkvhh710gwjnnjx59kaplx2ncfvkx9agfa76rr94sbjqq4igddm";
+  };
+  hash = hashes. ${system} or (throw "missing bootstrap hash for platform ${system}");
+
+  platforms = {
+    x86_64-linux = "x86_64-unknown-linux-musl";
+    x86_64-darwin = "x86_64-apple-darwin";
+  };
+  platform = platforms . ${system};
+
+in stdenv.mkDerivation {
+  name = "cargo-vendor-${version}";
+
+  src = fetchurl {
+     url = "https://github.com/alexcrichton/cargo-vendor/releases/download/${version}/cargo-vendor-${version}-${platform}.tar.gz";
+     sha256 = hash;
+  };
+
+  phases = "unpackPhase installPhase";
+
+  installPhase = ''
+    install -Dm755 cargo-vendor $out/bin/cargo-vendor
+  '';
+}
diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix
index 36130289fbaa..2b32da11d1ce 100644
--- a/pkgs/build-support/rust/default.nix
+++ b/pkgs/build-support/rust/default.nix
@@ -1,10 +1,14 @@
-{ stdenv, callPackage, path, cacert, git, rust, rustRegistry }:
-
+{ fetchurl, stdenv, path, cacert, git, rust }:
 let
-  rustRegistry' = rustRegistry;
+  cargoVendor = import ./cargo-vendor.nix {
+    inherit fetchurl stdenv;
+  };
+
+  fetchcargo = import ./fetchcargo.nix {
+    inherit stdenv cacert git rust cargoVendor;
+  };
 in
-{ name, depsSha256
-, rustRegistry ? rustRegistry'
+{ name, cargoSha256
 , src ? null
 , srcs ? null
 , sourceRoot ? null
@@ -18,17 +22,13 @@ in
 let
   lib = stdenv.lib;
 
-  fetchDeps = import ./fetchcargo.nix {
-    inherit stdenv cacert git rust rustRegistry;
-  };
-
-  cargoDeps = fetchDeps {
+  cargoDeps = fetchcargo {
     inherit name src srcs sourceRoot cargoUpdateHook;
-    sha256 = depsSha256;
+    sha256 = cargoSha256;
   };
 
 in stdenv.mkDerivation (args // {
-  inherit cargoDeps rustRegistry;
+  inherit cargoDeps;
 
   patchRegistryDeps = ./patch-registry-deps;
 
@@ -43,71 +43,24 @@ in stdenv.mkDerivation (args // {
   postUnpack = ''
     eval "$cargoDepsHook"
 
-    echo "Using cargo deps from $cargoDeps"
+    mkdir .cargo
+    cat >.cargo/config <<-EOF
+      [source.crates-io]
+      registry = 'https://github.com/rust-lang/crates.io-index'
+      replace-with = 'vendored-sources'
 
-    cp -a "$cargoDeps" deps
-    chmod +w deps -R
-
-    # It's OK to use /dev/null as the URL because by the time we do this, cargo
-    # won't attempt to update the registry anymore, so the URL is more or less
-    # irrelevant
-
-    cat <<EOF > deps/config
-    [registry]
-    index = "file:///dev/null"
+      [source.vendored-sources]
+      directory = '$cargoDeps'
     EOF
 
-    export CARGO_HOME="$(realpath deps)"
     export RUST_LOG=${logLevel}
     export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
-
-    # Let's find out which $indexHash cargo uses for file:///dev/null
-    (cd $sourceRoot && cargo fetch &>/dev/null) || true
-    cd deps
-    indexHash="$(basename $(echo registry/index/*))"
-
-    echo "Using indexHash '$indexHash'"
-
-    rm -rf -- "registry/cache/$indexHash" \
-              "registry/index/$indexHash"
-
-    mv registry/cache/HASH "registry/cache/$indexHash"
-
-    echo "Using rust registry from $rustRegistry"
-    ln -s "$rustRegistry" "registry/index/$indexHash"
-
-    # Retrieved the Cargo.lock file which we saved during the fetch
-    cd ..
-    mv deps/Cargo.lock $sourceRoot/
-
-    (
-        cd $sourceRoot
-
-        cargo fetch
-        cargo clean
-    )
   '' + (args.postUnpack or "");
 
-  prePatch = ''
-    # Patch registry dependencies, using the scripts in $patchRegistryDeps
-    (
-        set -euo pipefail
-
-        cd $NIX_BUILD_TOP/deps/registry/src/*
-
-        for script in $patchRegistryDeps/*; do
-          # Run in a subshell so that directory changes and shell options don't
-          # affect any following commands
-
-          ( . $script)
-        done
-    )
-  '' + (args.prePatch or "");
-
   buildPhase = with builtins; args.buildPhase or ''
     runHook preBuild
     echo "Running cargo build --release ${concatStringsSep " " cargoBuildFlags}"
-    cargo build --release ${concatStringsSep " " cargoBuildFlags}
+    cargo build --release --frozen ${concatStringsSep " " cargoBuildFlags}
     runHook postBuild
   '';
 
@@ -126,4 +79,6 @@ in stdenv.mkDerivation (args // {
     find target/release -maxdepth 1 -executable -exec cp "{}" $out/bin \;
     runHook postInstall
   '';
+
+  passthru = { inherit cargoDeps; };
 })
diff --git a/pkgs/build-support/rust/fetch-cargo-deps b/pkgs/build-support/rust/fetch-cargo-deps
deleted file mode 100755
index 3c7e034364f4..000000000000
--- a/pkgs/build-support/rust/fetch-cargo-deps
+++ /dev/null
@@ -1,209 +0,0 @@
-# copied from libgit2 source code 'repo-template.h'
-makeGitTemplate() {
-    local target="$1"
-    mkdir -p -m777 "$target/info" "$target/pack" "$target/objects" "$target/refs"
-    mkdir -p -m777 "$target/refs/heads" "$target/refs/tags" "$target/objects/info" "$target/objects/pack"
-    cat <<'EOF' > "$target/description"
-Unnamed repository; edit this file 'description' to name the repository.
-EOF
-    chmod 666 "$target/description"
-    cat <<'EOF' > "$target/info/exclude"
-# File patterns to ignore; see `git help ignore` for more information.
-# Lines that start with '#' are comments.
-EOF
-}
-
-fetchCargoDeps() {
-    src=$(realpath $1)
-    out=$(realpath $2)
-
-    echo "Fetching $src to $out"
-
-    mkdir $out
-
-    # Configure git template dir to make libgit2 more deterministic
-    #
-    # Without a template dir, libgit2 defaults to /usr/share/git-core/templates,
-    # which can vary between systems if sandboxed builds aren't used.
-    #
-    # Note: we explictly set --tmpdir for mktemp here to make it more friendly
-    # for nix-shell users, where $TMPDIR is not necessarily set to NIX_BUILD_TOP
-    echo "Setting up git templatedir"
-    export GIT_TEMPLATE_DIR="$(mktemp -d --tmpdir=$NIX_BUILD_TOP git-template.XXX)"
-    makeGitTemplate "$GIT_TEMPLATE_DIR"
-    export XDG_CONFIG_HOME="$(mktemp -d --tmpdir=$NIX_BUILD_TOP home.XXX)"
-    mkdir -p $XDG_CONFIG_HOME/git
-    cat <<EOF > $XDG_CONFIG_HOME/git/config
-[init]
-  templatedir = $GIT_TEMPLATE_DIR
-EOF
-
-    # Configure cargo to fetch from a local copy of the crates.io registry
-
-    echo "Using rust registry from $rustRegistry"
-
-    cat <<EOF > $out/config
-[registry]
-index = "file://$rustRegistry"
-EOF
-
-    export CARGO_HOME=$out
-    cd $src
-
-    if [[ ! -f Cargo.lock ]]; then
-        echo
-        echo "ERROR: The Cargo.lock file doesn't exist"
-        echo
-        echo "Cargo.lock is needed to make sure that depsSha256 doesn't change"
-        echo "when the registry is updated."
-        echo
-
-        exit 1
-    fi
-
-    # We need to do the following string replacement so that 'cargo fetch'
-    # doesn't ignore the versions specified in Cargo.lock
-    substituteInPlace Cargo.lock \
-        --replace "registry+https://github.com/rust-lang/crates.io-index" \
-                  "registry+file://$rustRegistry"
-
-    # Do any possible 'cargo update -p <pkgName> --precise <version>' ad-hoc updates
-    eval "$cargoUpdateHook"
-
-    # Do the fetch
-    cargo fetch --verbose
-
-    # Now that we have fetched everything, let's make the output deterministic
-
-    # Cargo uses the following directory structure for fetched data, where
-    # $indexHash is a hash of the registry index URL:
-    #
-    #
-    # /config:
-    #
-    #     Cargo config file. We'll delete this because it's not deterministic,
-    #     and instead recreate it just before running 'cargo build'.
-    #
-    # /registry/cache/$indexHash/:
-    #
-    #     This is where tarballs of registry package dependencies are kept
-    #     We'll need to keep this, but make sure $indexHash is a fixed name.
-    #
-    # /registry/index/$indexHash/:
-    #
-    #     A copy of the registry index is kept here. We can delete this, and
-    #     instead, just before running 'cargo build', we'll symlink this
-    #     directory to our static copy of the registry in the Nix store.
-    #
-    # /registry/src/$indexHash/{pkgName-pkgVersion}/:
-    #
-    #     Here cargo keeps extracted sources of the cached tarballs.
-    #     We'll just delete this because cargo will re-populate them from the
-    #     tarballs.
-    #
-    # /git/db/{domain-hash}/:
-    #
-    #     Here cargo keeps the `.git` directories of git dependencies.
-    #     We'll need to keep these, but make them deterministic.
-    #
-    # /git/checkouts/{domain-hash}/{branchName}/:
-    #
-    #     Here cargo keeps checked-out sources of the git dependencies.
-    #     We can delete this, because cargo will re-populate them from the above
-    #     `.git` directories.
-    #
-    # Let's start
-
-    # Remove cargo config file, which points to the ever-changing registry
-    rm $out/config
-
-    # Save the Cargo.lock file into the output, so that we don't have to do another
-    # 'cargo update' during the build (which would try to access the network) for
-    # any ad-hoc package updates (through $cargoUpdateHook).
-    #
-    # We need to replace the rustRegistry URL with something deterministic.
-    # Since the URL won't actually be accessed anymore, it's fine to use /dev/null.
-
-    substituteInPlace Cargo.lock \
-        --replace "registry+file://$rustRegistry" \
-                  "registry+file:///dev/null"
-    mv Cargo.lock $out/
-
-
-    # Let's replace $indexHash with something more deterministic
-    mv $out/registry/cache/* $out/registry/cache/HASH
-
-    # The registry index changes all the time, so it's not deterministic
-    # We'll symlink it before running 'cargo build'
-    rm -rf $out/registry/index/*
-
-    # Make git DBs deterministic
-    # TODO: test with git submodules
-    [[ ! -d $out/git/checkouts ]] || (cd $out/git/checkouts && for name in *; do
-        revs=""
-        cd "$out/git/checkouts/$name"
-        while read dir; do
-            # extract substring: [dir = "./xxx/yyy/.git"] => [branch = "xxx/yyy"]
-            branch="${dir:2:$((${#dir}-7))}"
-
-            cd "$out/git/checkouts/$name/$branch"
-            rev="$(git rev-parse HEAD)"
-            revs="$rev $revs"
-        done < <(find . -type d -name .git -print)
-
-        echo "List of revs to keep for git db $name: $revs"
-
-        (
-            # The following code was adapted from nix-prefetch-git
-
-            cd "$out/git/db/$name"
-
-            export GIT_DIR=.
-
-            # Remove all remote branches
-            git branch -r | while read branch; do
-                git branch -rD "$branch" >&2
-            done
-
-            # Remove all tags
-            git tag | while read tag; do
-                git tag -d "$tag" >&2
-            done
-
-            # Remove all local branches
-            branchrefs=()
-            eval "$(git for-each-ref --shell --format='branchrefs+=(%(refname))' refs/heads/)"
-
-            for branchref in "${branchrefs[@]}"; do
-                git update-ref -d "$branchref" >&2
-            done
-
-            # Create ad-hoc branches for the revs we need
-            echo "$revs" | while read -d " " rev; do
-                echo "Creating git branch b_$rev $rev"
-                git branch b_$rev $rev
-            done
-
-            # Remove files that have timestamps or otherwise have non-deterministic
-            # properties.
-            rm -rf logs/ hooks/ index FETCH_HEAD ORIG_HEAD refs/remotes/origin/HEAD config
-
-            # Do a full repack. Must run single-threaded, or else we lose determinism.
-            git config pack.threads 1
-            git repack -A -d -f
-            rm -f config
-
-            # Garbage collect unreferenced objects.
-            git gc --prune=all
-        )
-    done)
-
-    # Remove unneeded outputs
-    [[ ! -d $out/registry/src ]] || rm -rf $out/registry/src
-    [[ ! -d $out/git/checkouts ]] || rm -rf $out/git/checkouts
-
-    # XXX: provide some debugging output to see find out why we are seeing
-    # sporadic hash mismatches
-    find $out ! -type f
-    find $out -type f -exec sha256sum {} +
-}
diff --git a/pkgs/build-support/rust/fetchcargo.nix b/pkgs/build-support/rust/fetchcargo.nix
index 0c9625e51405..9b3ba5303398 100644
--- a/pkgs/build-support/rust/fetchcargo.nix
+++ b/pkgs/build-support/rust/fetchcargo.nix
@@ -1,19 +1,30 @@
-{ stdenv, cacert, git, rust, rustRegistry }:
+{ stdenv, cacert, git, rust, cargoVendor }:
 { name ? "cargo-deps", src, srcs, sourceRoot, sha256, cargoUpdateHook ? "" }:
-
 stdenv.mkDerivation {
-  name = "${name}-fetch";
-  buildInputs = [ rust.cargo rust.rustc git ];
-  inherit src srcs sourceRoot rustRegistry cargoUpdateHook;
+  name = "${name}-vendor";
+  buildInputs = [ cacert cargoVendor git rust.cargo ];
+  inherit src srcs sourceRoot;
 
   phases = "unpackPhase installPhase";
 
   installPhase = ''
-    source ${./fetch-cargo-deps}
+    if [[ ! -f Cargo.lock ]]; then
+        echo
+        echo "ERROR: The Cargo.lock file doesn't exist"
+        echo
+        echo "Cargo.lock is needed to make sure that cargoSha256 doesn't change"
+        echo "when the registry is updated."
+        echo
+
+        exit 1
+    fi
 
     export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
+    export CARGO_HOME=$(mktemp -d cargo-home.XXX)
+
+    cargo vendor
 
-    fetchCargoDeps . "$out"
+    cp -ar vendor $out
   '';
 
   outputHashAlgo = "sha256";
diff --git a/pkgs/development/compilers/rust/cargo.nix b/pkgs/development/compilers/rust/cargo.nix
index 2f1cf07c3b8b..ec890b3bf7a2 100644
--- a/pkgs/development/compilers/rust/cargo.nix
+++ b/pkgs/development/compilers/rust/cargo.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchFromGitHub, file, curl, pkgconfig, python, openssl, cmake, zlib
 , makeWrapper, libiconv, cacert, rustPlatform, rustc, libgit2
-, version, srcSha, depsSha256
+, version, srcSha, cargoSha256
 , patches ? []}:
 
 rustPlatform.buildRustPackage rec {
@@ -14,7 +14,7 @@ rustPlatform.buildRustPackage rec {
     sha256 = srcSha;
   };
 
-  inherit depsSha256;
+  inherit cargoSha256;
   inherit patches;
 
   passthru.rustc = rustc;
diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix
index 122bda0f70b5..73788189af32 100644
--- a/pkgs/development/compilers/rust/default.nix
+++ b/pkgs/development/compilers/rust/default.nix
@@ -22,7 +22,7 @@ rec {
     };
 
     patches = [
-      ./patches/darwin-disable-fragile-tcp-tests.patch
+      ./patches/0001-Disable-fragile-tests-libstd-net-tcp-on-Darwin-Linux.patch
     ] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
 
   };
@@ -30,7 +30,7 @@ rec {
   cargo = callPackage ./cargo.nix rec {
     version = "0.21.1";
     srcSha = "1nz7sz7rzc6i1c0nzf6kmnmaq1l3hgrg19s589q7k309r6m7p7f7";
-    depsSha256 = "0pzfn1zjgklr0fw9zi9sxrwr08q3wcvdl9ybxrk3ld7ps5h9wmsi";
+    cargoSha256 = "02gdh71jkhmr17q5gam079ig5dvpw1fms3v6k5h2bg3fclw7kkrs";
 
     inherit rustc; # the rustc that will be wrapped by cargo
     inherit rustPlatform; # used to build cargo
diff --git a/pkgs/development/compilers/rust/patches/darwin-disable-fragile-tcp-tests.patch b/pkgs/development/compilers/rust/patches/0001-Disable-fragile-tests-libstd-net-tcp-on-Darwin-Linux.patch
index da550f0327d3..f55d0badb823 100644
--- a/pkgs/development/compilers/rust/patches/darwin-disable-fragile-tcp-tests.patch
+++ b/pkgs/development/compilers/rust/patches/0001-Disable-fragile-tests-libstd-net-tcp-on-Darwin-Linux.patch
@@ -1,17 +1,18 @@
-From 1d8a91d5b09cb762fe890d04bfb61b9eefd0624a Mon Sep 17 00:00:00 2001
-From: Moritz Ulrich <moritz@tarn-vedra.de>
-Date: Sun, 8 Jan 2017 10:28:17 +0100
-Subject: [PATCH] Disable libstd::net::tcp::{ttl, timeouts} on Darwin
+From 26d3b70abec1adf773522643b31ce9c03439916a Mon Sep 17 00:00:00 2001
+From: Joerg Thalheim <joerg@thalheim.io>
+Date: Tue, 10 Oct 2017 00:40:20 +0100
+Subject: [PATCH] Disable fragile tests libstd::net::tcp on Darwin/Linux
 
+Signed-off-by: Joerg Thalheim <joerg@thalheim.io>
 ---
- src/libstd/net/tcp.rs | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
+ src/libstd/net/tcp.rs | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
 
 diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs
-index 0e7c5b0671..d42fd26267 100644
+index 8d1e7882e5..2c223fb315 100644
 --- a/src/libstd/net/tcp.rs
 +++ b/src/libstd/net/tcp.rs
-@@ -551,6 +551,7 @@ mod tests {
+@@ -949,6 +949,7 @@ mod tests {
          })
      }
  
@@ -19,7 +20,7 @@ index 0e7c5b0671..d42fd26267 100644
      #[test]
      fn write_close() {
          each_ip(&mut |addr| {
-@@ -1022,7 +1023,10 @@ mod tests {
+@@ -1421,7 +1422,10 @@ mod tests {
  
      // FIXME: re-enabled bitrig/openbsd tests once their socket timeout code
      //        no longer has rounding errors.
@@ -31,7 +32,7 @@ index 0e7c5b0671..d42fd26267 100644
      #[test]
      fn timeouts() {
          let addr = next_test_ip4();
-@@ -1101,6 +1105,7 @@ mod tests {
+@@ -1500,6 +1504,7 @@ mod tests {
          assert_eq!(false, t!(stream.nodelay()));
      }
  
@@ -39,6 +40,14 @@ index 0e7c5b0671..d42fd26267 100644
      #[test]
      fn ttl() {
          let ttl = 100;
+@@ -1568,6 +1573,7 @@ mod tests {
+         })
+     }
+ 
++    #[cfg_attr(target_os = "linux", ignore)]
+     #[test]
+     fn connect_timeout_unroutable() {
+         // this IP is unroutable, so connections should always time out,
 -- 
-2.11.0
+2.14.2
 
diff --git a/pkgs/development/misc/loc/default.nix b/pkgs/development/misc/loc/default.nix
index 681e6fcc528a..fd5796276f7a 100644
--- a/pkgs/development/misc/loc/default.nix
+++ b/pkgs/development/misc/loc/default.nix
@@ -3,17 +3,17 @@
 with rustPlatform;
 
 buildRustPackage rec {
-  version = "0.3.4";
+  version = "2017-06-23";
   name = "loc-${version}";
 
   src = fetchFromGitHub {
     owner = "cgag";
     repo = "loc";
-    rev = "9f3590f6299a1be3560f00de7f4f8bef61a02642";
-    sha256 = "0dga8prwnnmsa616jh64wzic957ff0491xghm0bjlns35ajc8lif";
+    rev = "bbea575f56879ef614d57a42a6b79fd45b9a8b38";
+    sha256 = "0agyhi55rh248fmlsip4fi1iw4xv3433q7bcb2lpjfnjpzxxlvfn";
   };
 
-  depsSha256 = "1xcfhbnz208dk7xb748v8kv28zbhyr7wqg9gsgbiw3lnvc2a3nn6";
+  cargoSha256 = "0f3i8av9g19r2nhr9m8ca8s23kq294c5kqyvx155l6p76r7a9kvb";
 
   meta = {
     homepage = http://github.com/cgag/loc;
diff --git a/pkgs/development/tools/clog-cli/default.nix b/pkgs/development/tools/clog-cli/default.nix
index f64ead3e1078..1cd8f7757f96 100644
--- a/pkgs/development/tools/clog-cli/default.nix
+++ b/pkgs/development/tools/clog-cli/default.nix
@@ -13,7 +13,7 @@ buildRustPackage rec {
     sha256 = "1wxglc4n1dar5qphhj5pab7ps34cjr7jy611fwn72lz0f6c7jp3z";
   };
 
-  depsSha256 = "0gkg3bxx7nxsvff33n7pif731djfvlzk0msia27h0wq0mazq7kw3";
+  cargoSha256 = "1pi8fh6vz6m5hr38wm0v0hxp1yxm1ma8yzish3b78zkv8f90kmv0";
 
   meta = {
     description = "Generate changelogs from local git metadata";
diff --git a/pkgs/development/tools/git-series/default.nix b/pkgs/development/tools/git-series/default.nix
index b792cfe8c994..44120ad023ae 100644
--- a/pkgs/development/tools/git-series/default.nix
+++ b/pkgs/development/tools/git-series/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, rustPlatform, openssl, cmake, perl, pkgconfig, zlib }:
+{ stdenv, fetchFromGitHub, fetchpatch, rustPlatform, openssl, cmake, perl, pkgconfig, zlib }:
 
 with rustPlatform;
 
@@ -13,14 +13,24 @@ buildRustPackage rec {
     sha256 = "07mgq5h6r1gf3jflbv2khcz32bdazw7z1s8xcsafdarnm13ps014";
   };
 
-  depsSha256 = "1xypk9ck7znca0nqm61m5ngpz6q7c0wydlpwxq4mnkd1np27xn53";
+  cargoSha256 = "06w864f73kijq24xzljfaf47d97aqyg4md3crzbq8hns157m3sv2";
+
+  cargoDepsHook = ''
+    (
+      cd ${name}-src
+      # see https://github.com/git-series/git-series/pull/56
+      patch -p1 < ${fetchpatch {
+        url = "https://github.com/Mic92/git-series/commit/3aa30a47d74ebf90b444dccdf8c153f07f119483.patch";
+        sha256 = "06v8br9skvy75kcw2zgbswxyk82sqzc8smkbqpzmivxlc2i9rnh0";
+      }}
+    )
+  '';
 
   nativeBuildInputs = [ cmake pkgconfig perl ];
   buildInputs = [ openssl zlib ];
 
   postBuild = ''
-    mkdir -p "$out/man/man1"
-    cp "$src/git-series.1" "$out/man/man1"
+    install -D "$src/git-series.1" "$out/man/man1/git-series.1"
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/tools/misc/tokei/default.nix b/pkgs/development/tools/misc/tokei/default.nix
index c0a56648db97..b44548c8ffd3 100644
--- a/pkgs/development/tools/misc/tokei/default.nix
+++ b/pkgs/development/tools/misc/tokei/default.nix
@@ -11,7 +11,7 @@ rustPlatform.buildRustPackage rec {
     sha256 = "1bzs3mr6f9bna39b9ddwwq0raas07nbn106mnq3widxg59i0gxhd";
   };
 
-  depsSha256 = "1cz93mrpxmyrza0ipdyg2a6mynl66plpsb446wxnmmy7y7zd6xbf";
+  cargoSha256 = "0y0rkxhkv31v5sa0425dwskd80i6srwbqhqkrw1g1kbmbs9y0vxz";
 
   installPhase = ''
     mkdir -p $out/bin
@@ -19,6 +19,7 @@ rustPlatform.buildRustPackage rec {
   '';
 
   meta = with stdenv.lib; {
+    broken = true;
     description = "Count code, quickly";
     homepage = https://github.com/Aaronepower/tokei;
     license = licenses.mit;
diff --git a/pkgs/development/tools/rq/default.nix b/pkgs/development/tools/rq/default.nix
index eef8b660c41d..ca2aea2399f0 100644
--- a/pkgs/development/tools/rq/default.nix
+++ b/pkgs/development/tools/rq/default.nix
@@ -13,7 +13,7 @@ buildRustPackage rec {
     sha256 = "066f6sdy0vrp113wlg18q9p0clyrg9iqbj17ly0yn8dxr5iar002";
   };
 
-  depsSha256 = "138h0q2a2gghfjpwfi11zw4rkipvmglb7srqz56ibbw2xliid2wl";
+  cargoSha256 = "0c4awm1d87b396d3g3mp1md5p92i5a64a9jdawpr8mwjd0bly05m";
 
   buildInputs = [ llvmPackages.clang-unwrapped v8 ];
 
diff --git a/pkgs/development/tools/rust/bindgen/default.nix b/pkgs/development/tools/rust/bindgen/default.nix
index 78a327c9ea15..1240e7cc38f4 100644
--- a/pkgs/development/tools/rust/bindgen/default.nix
+++ b/pkgs/development/tools/rust/bindgen/default.nix
@@ -24,7 +24,7 @@ rustPlatform.buildRustPackage rec {
     wrapProgram $out/bin/bindgen --set LIBCLANG_PATH "${llvmPackages.clang-unwrapped}/lib"
   '';
 
-  depsSha256 = "06b5zyw9p7h73h30c1nlnwjb0zmkfx52wqsl9b14y9hx51g9bw0r";
+  cargoSha256 = "128skg31lc9v8i7ghfb3wyiazivqfvzhi1mvmjcl0gkx1hi5006v";
 
   doCheck = false; # A test fails because it can't find standard headers in NixOS
 
diff --git a/pkgs/development/tools/rust/racer/default.nix b/pkgs/development/tools/rust/racer/default.nix
index 89c384eb6eca..57b685e946d0 100644
--- a/pkgs/development/tools/rust/racer/default.nix
+++ b/pkgs/development/tools/rust/racer/default.nix
@@ -11,7 +11,7 @@ rustPlatform.buildRustPackage rec {
     sha256 = "06k50f2vj2w08afh3nrlhs0amcvw2i45bhfwr70sgs395xicjswp";
   };
 
-  depsSha256 = "1gywnjbjl9jalbq6wkfmbczav4qbhgw2h8lyxkyppnhw9y4j0nc1";
+  cargoSha256 = "1w5imxyqlyv24dvzncq6dy01zn2x8p1aciyvzh8ac1x1wdjcacjc";
 
   buildInputs = [ makeWrapper ];
 
diff --git a/pkgs/development/tools/rust/racerd/default.nix b/pkgs/development/tools/rust/racerd/default.nix
index b2340e01c1a5..f3cb4e789502 100644
--- a/pkgs/development/tools/rust/racerd/default.nix
+++ b/pkgs/development/tools/rust/racerd/default.nix
@@ -14,7 +14,7 @@ buildRustPackage rec {
 
   doCheck = false;
 
-  depsSha256 = "0db18m0vxzvg821gb5g8njhlnxw7im81m089i4982n8hmnhm1497";
+  cargoSha256 = "1h7hm7vkk1grah6pn5ydfi5pzc2kd48lh2kxim5jlvrxhd2dingg";
 
   buildInputs = [ makeWrapper ];
 
diff --git a/pkgs/development/tools/rust/rainicorn/default.nix b/pkgs/development/tools/rust/rainicorn/default.nix
index b6cbeb88402b..370318d1ff29 100644
--- a/pkgs/development/tools/rust/rainicorn/default.nix
+++ b/pkgs/development/tools/rust/rainicorn/default.nix
@@ -13,9 +13,10 @@ buildRustPackage rec {
     sha256 = "07vh4g120sx569wkzclq91blkkd7q7z582pl8vz0li1l9ij8md01";
   };
 
-  depsSha256 = "1ckrf77s1glrqi0gvrv9wqmip4i97dk0arn0iz87jg4q2wfss85k";
+  cargoSha256 = "14kd25mw6m20blqcr221cclcqxw0j229zxq8hsaay6q7jgv0c7a0";
 
   meta = with stdenv.lib; {
+    broken = true;
     description = "Rust IDEs.  parse-analysis";
     homepage = https://github.com/RustDT/Rainicorn;
     license = with licenses; [ mit asl20 ];
diff --git a/pkgs/development/tools/rust/rustfmt/default.nix b/pkgs/development/tools/rust/rustfmt/default.nix
index 0e3802a214f1..b8585dace544 100644
--- a/pkgs/development/tools/rust/rustfmt/default.nix
+++ b/pkgs/development/tools/rust/rustfmt/default.nix
@@ -11,7 +11,7 @@ rustPlatform.buildRustPackage rec {
     sha256 = "12l3ff0s0pzhcf5jbs8wqawjk4jghhhz8j6dq1n5201yvny12jlr";
   };
 
-  depsSha256 = "1nnb2lpzjf6hv1a7cw3cbkc22fb54rsp6h87wzmqi4hsy1csff7a";
+  cargoSha256 = "0gppki9mgx99xipapg36ydwk1bplygnz6sbyzbg46vhn10iggfwm";
 
   meta = with stdenv.lib; {
     description = "A tool for formatting Rust code according to style guidelines";
diff --git a/pkgs/development/tools/rust/rustup/default.nix b/pkgs/development/tools/rust/rustup/default.nix
index 59cdf443f4ab..65599ad8d18f 100644
--- a/pkgs/development/tools/rust/rustup/default.nix
+++ b/pkgs/development/tools/rust/rustup/default.nix
@@ -6,7 +6,7 @@ rustPlatform.buildRustPackage rec {
   name = "rustup-${version}";
   version = "1.3.0";
 
-  depsSha256 = "078hssgffgpakv735p1xg60kic151r2dvpdr9sipb63lwqr4dxfb";
+  cargoSha256 = "1yd7k0jpx78p5bp6iyzgbyj7pjz8vyjg9g7fmf1bl60jsbdpgv3g";
 
   src = fetchFromGitHub {
     owner = "rust-lang-nursery";
diff --git a/pkgs/misc/tw-rs/default.nix b/pkgs/misc/tw-rs/default.nix
index 2459e157a905..37a609db0369 100644
--- a/pkgs/misc/tw-rs/default.nix
+++ b/pkgs/misc/tw-rs/default.nix
@@ -14,7 +14,7 @@ rustPlatform.buildRustPackage rec {
   buildInputs = [ perl zlib openssl ]
     ++ stdenv.lib.optional stdenv.isDarwin curl;
 
-  depsSha256 = "1lg1jh6f9w28i94vaj62r859g6raalxmxabvw7av6sqr0hr56p05";
+  cargoSha256 = "0c3324b7z77kiwc6whbppfmrli254fr1nyd0vpsxvpc0av3279jg";
 
   meta = with stdenv.lib; {
     description = "Twitter command-line interface written in rust";
diff --git a/pkgs/shells/ion/default.nix b/pkgs/shells/ion/default.nix
index 4ab03b31fb93..b7e42370125d 100644
--- a/pkgs/shells/ion/default.nix
+++ b/pkgs/shells/ion/default.nix
@@ -13,7 +13,7 @@ buildRustPackage rec {
     sha256 = "0c2haw9qiwysyp1xj6qla8d6zpsdlygagzh86sk04c2b4ssyaca3";
   };
 
-  depsSha256 = "0w2jgbrcx57js8ihzs5acp6b1niw1c7khdxrv14y3z9mmm9j55hs";
+  cargoSha256 = "0ydi44710as0bb442zryzx30nk4mscdw3gsahwprnsvvaril33rn";
 
   meta = with stdenv.lib; {
     description = "Modern system shell with simple (and powerful) syntax";
diff --git a/pkgs/tools/admin/intecture/agent.nix b/pkgs/tools/admin/intecture/agent.nix
index 4024ab9b91f2..2b663cd3bcee 100644
--- a/pkgs/tools/admin/intecture/agent.nix
+++ b/pkgs/tools/admin/intecture/agent.nix
@@ -14,7 +14,7 @@ buildRustPackage rec {
     sha256 = "0j27qdgyxybaixggh7k57mpm6rifimn4z2vydk463msc8b3kgywj";
   };
 
-  depsSha256 = "1n57i9wkak76ram748mwq0dn32d041ajd31laqc13c76pp29agrp";
+  cargoSha256 = "1fcl2nnplcic729cmvall2k7wf3jdm7dspvlbxji99bn813ackig";
 
   buildInputs = [ openssl zeromq czmq zlib ];
 
diff --git a/pkgs/tools/admin/intecture/auth.nix b/pkgs/tools/admin/intecture/auth.nix
index c4678c8d4b77..759230c6a293 100644
--- a/pkgs/tools/admin/intecture/auth.nix
+++ b/pkgs/tools/admin/intecture/auth.nix
@@ -14,7 +14,7 @@ buildRustPackage rec {
     sha256 = "0c7ar3pc7n59lzfy74lwz51p09s2bglc870rfr4c0vmc91jl0pj2";
   };
 
-  depsSha256 = "0wzr8hk63gh3nm8f7dbzwj8pgc3cm8p8mr2q7bbgvri1a5i83sfb";
+  cargoSha256 = "0q3mrcvl1yyrx4a88kanjlfcx6slf7r79i0dh4w81sj6gp07sssm";
 
   buildInputs = [ openssl zeromq czmq zlib ];
 
diff --git a/pkgs/tools/admin/intecture/cli.nix b/pkgs/tools/admin/intecture/cli.nix
index e98b62bd0ea7..a4ac74e9f2da 100644
--- a/pkgs/tools/admin/intecture/cli.nix
+++ b/pkgs/tools/admin/intecture/cli.nix
@@ -14,7 +14,7 @@ buildRustPackage rec {
     sha256 = "16a5fkpyqkf8w20k3ircc1d0qmif7nygkzxj6mzk9609dlb0dmxq";
   };
 
-  depsSha256 = "0nax7h7f5qgalgxsfidrxrv1ybl5xvrpc1k7xc1kmaf955gqmc46";
+  cargoSha256 = "0qwbgwxrjc0dvjbpqa59jixy5nq7lng2c1z91rw48qc91v7fa664";
 
   buildInputs = [ openssl zeromq czmq zlib ];
 
diff --git a/pkgs/tools/filesystems/btrfs-dedupe/default.nix b/pkgs/tools/filesystems/btrfs-dedupe/default.nix
index 4c22268a1c8d..d2a82dc357b5 100644
--- a/pkgs/tools/filesystems/btrfs-dedupe/default.nix
+++ b/pkgs/tools/filesystems/btrfs-dedupe/default.nix
@@ -12,7 +12,7 @@ buildRustPackage rec {
     sha256 = "0qy1g4crhfgs2f5cmrsjv6qscg3r66gb8n6sxhimm9ksivhjyyjp";
   };
 
-  depsSha256 = "04jlz7nzsmg86i73w75i8rmlbk635xrg8m1dfac8h17dwb29yj6a";
+  cargoSha256 = "0dmn9bccicxhqcj9zrsxxp0vb5ma12a1hs9brpc22n4g1qy4yzcn";
 
   buildInputs = [ lzo zlib ];
 
diff --git a/pkgs/tools/misc/exa/default.nix b/pkgs/tools/misc/exa/default.nix
index 488f7482b154..cb77edf0d29a 100644
--- a/pkgs/tools/misc/exa/default.nix
+++ b/pkgs/tools/misc/exa/default.nix
@@ -6,7 +6,7 @@ buildRustPackage rec {
   name = "exa-${version}";
   version = "0.8.0";
 
-  depsSha256 = "0yz41prkjs5rmvdhr9k58a52l7hvwy5mfg8rcpsq4ybgf601lja2";
+  cargoSha256 = "08zzn3a32xfjkmpawcjppn1mr26ws3iv40cckiz8ldz4qc8y9gdh";
 
   src = fetchFromGitHub {
     owner = "ogham";
diff --git a/pkgs/tools/misc/fd/default.nix b/pkgs/tools/misc/fd/default.nix
index 07d8a661d7b7..54d17e6f64cc 100644
--- a/pkgs/tools/misc/fd/default.nix
+++ b/pkgs/tools/misc/fd/default.nix
@@ -11,7 +11,7 @@ rustPlatform.buildRustPackage rec {
     sha256 = "1aw4pgsmvzzqlvbxzv5jnw42nf316qfhvr50b58iqi2dxy8z8cmv";
   };
 
-  depsSha256 = "17fjlmdwp8582dvv68b5h3zzvmd71yd9sw9xalyrrww46h7fd84g";
+  cargoSha256 = "1v9wg4dq4c7i85bkdhd79bj8gx7200z6np05wsyj2ycbv97p095j";
 
   meta = {
     description = "A simple, fast and user-friendly alternative to find";
diff --git a/pkgs/tools/misc/heatseeker/default.nix b/pkgs/tools/misc/heatseeker/default.nix
index 499b4a87bc43..e7ddcf572aed 100644
--- a/pkgs/tools/misc/heatseeker/default.nix
+++ b/pkgs/tools/misc/heatseeker/default.nix
@@ -13,7 +13,7 @@ buildRustPackage rec {
     sha256 = "1fcrbjwnhcz71i70ppy0rcgk5crwwmbkm9nrk1kapvks33pv0az7";
   };
 
-  depsSha256 = "05mj84a5k65ai492grwg03c3wq6ardhs114bv951fgysc9rs07p5";
+  cargoSha256 = "0kqkzjd90v19qvl3iv1vv2fi8h0z75b0yn0z5jq8w4m94fvh0p95";
 
   # some tests require a tty, this variable turns them off for Travis CI,
   # which we can also make use of
diff --git a/pkgs/tools/package-management/cargo-edit/default.nix b/pkgs/tools/package-management/cargo-edit/default.nix
index 4a34e62322d2..ecb0708eb307 100644
--- a/pkgs/tools/package-management/cargo-edit/default.nix
+++ b/pkgs/tools/package-management/cargo-edit/default.nix
@@ -15,7 +15,7 @@ buildRustPackage rec {
 
   buildInputs = [ zlib openssl ];
 
-  depsSha256 = "1v7ir56j6biximnnhyvadd98azcj3i5hc8aky0am2nf0swq0jimq";
+  cargoSha256 = "1m4yb7472g1n900dh3xqvdcywk3v01slj3bkk7bk7a9p5x1kyjfn";
 
   meta = with stdenv.lib; {
     description = "A utility for managing cargo dependencies from the command line";
@@ -23,5 +23,6 @@ buildRustPackage rec {
     license = with licenses; [ mit ];
     maintainers = with maintainers; [ jb55 ];
     platforms = platforms.all;
+    broken = true;
   };
 }
diff --git a/pkgs/tools/package-management/nix-index/default.nix b/pkgs/tools/package-management/nix-index/default.nix
index 70cd83b87a3b..df5a39d6a031 100644
--- a/pkgs/tools/package-management/nix-index/default.nix
+++ b/pkgs/tools/package-management/nix-index/default.nix
@@ -12,7 +12,7 @@ buildRustPackage rec {
     rev = "v${version}";
     sha256 = "1lmg65yqkwf2a5qxm3dmv8158kqhnriir062vlgar5wimf409rm5";
   };
-  depsSha256 = "0v145fi9bfiwvsdy7hz9lw4m2f2j8sxvixfzmjwfnq4klm51c8yl";
+  cargoSha256 = "0cxdrzjmqq3ywdh0f5mzkcf50hbbgd3bak4398v2ls5gy5s9fcz2";
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ openssl curl];
 
diff --git a/pkgs/tools/text/ripgrep/default.nix b/pkgs/tools/text/ripgrep/default.nix
index 8ddfa7d7be46..0d1c60dc6948 100644
--- a/pkgs/tools/text/ripgrep/default.nix
+++ b/pkgs/tools/text/ripgrep/default.nix
@@ -13,7 +13,7 @@ buildRustPackage rec {
     sha256 = "1cnvwxbznmsn1gand8hhy5zadax5p67lvm46fkj1a1s89f158w3a";
   };
 
-  depsSha256 = "1kx9xazhj93xa3cnys39wwr84qqjqrlsbbi5ih71vxppskdpvd6m";
+  cargoSha256 = "00y2vdnrg02clqin9pg57s9micrp66f6y49wq89cmykrfg3r8cwf";
 
   preFixup = ''
     mkdir -p "$out/man/man1"
diff --git a/pkgs/tools/text/staccato/default.nix b/pkgs/tools/text/staccato/default.nix
index 34e1413150f2..973585abc81f 100644
--- a/pkgs/tools/text/staccato/default.nix
+++ b/pkgs/tools/text/staccato/default.nix
@@ -11,9 +11,10 @@ rustPlatform.buildRustPackage rec {
     sha256 = "1zbd1gx0ik2r7bavcid776j37g6rzd3f6cs94kq1qar4gyf1gqjm";
   };
 
-  depsSha256 = "1gwfkh3ck8n3zcy43ch2mnc28a6y10p3srhnx9dh8gwnwbpb733c";
+  cargoSha256 = "074mfyanwdykg6wci2ia63wcnnyik741g8n624pac215sg4i95h7";
 
   meta = {
+    broken = true;
     description = "A command line program that lets you compute statistics from values from a file or standard input";
     longDescription = ''
       Staccato (`st` for short) is a command line program that lets you
diff --git a/pkgs/tools/text/xsv/default.nix b/pkgs/tools/text/xsv/default.nix
index db84eac4a237..23f172f4ebe1 100644
--- a/pkgs/tools/text/xsv/default.nix
+++ b/pkgs/tools/text/xsv/default.nix
@@ -13,7 +13,7 @@ buildRustPackage rec {
     sha256 = "0z1z3b6nzaid510jaikkawvpmv4kjphzz84p0hppq6vcp5jy00s2";
   };
 
-  depsSha256 = "13hy835871zxdnakwsr4bjm4krahlz4aqk5lh0rw78avfla89q9q";
+  cargoSha256 = "0pdzh2xr40dgwravh3i58g602bpszj6c8inggzgmq2kfk8ck6rgj";
 
   meta = with stdenv.lib; {
     description = "A fast CSV toolkit written in Rust";
diff --git a/pkgs/tools/typesetting/tectonic/default.nix b/pkgs/tools/typesetting/tectonic/default.nix
index f6c3be63e033..3fdebd19f3cb 100644
--- a/pkgs/tools/typesetting/tectonic/default.nix
+++ b/pkgs/tools/typesetting/tectonic/default.nix
@@ -14,7 +14,7 @@ buildRustPackage rec {
     sha256 = "0k5vkn112bjwh4wnxryzqz79dlja64k7s105mf3yaik136hqnmqv";
   };
 
-  depsSha256 = "1vxvkh1v9x6j4ggbh6sysi5i3089hrs0mjbp910a1jljiav7l8nj";
+  cargoSha256 = "03bqhgz8c4ipdkd3g448bcrr6d188h87vskcfcc3mqlcxg77b8q5";
 
   nativeBuildInputs = [ pkgconfig ];
 
diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix
index 9de635058317..20d9ba833549 100644
--- a/pkgs/top-level/aliases.nix
+++ b/pkgs/top-level/aliases.nix
@@ -130,7 +130,6 @@ mapAliases (rec {
   robomongo = robo3t; #added 2017-09-28
   rssglx = rss-glx; #added 2015-03-25
   rubygems = throw "deprecated 2016-03-02: rubygems is now bundled with ruby";
-  rustUnstable = rustNightly; # added 2016-11-29
   rxvt_unicode_with-plugins = rxvt_unicode-with-plugins; # added 2015-04-02
   samsungUnifiedLinuxDriver = samsung-unified-linux-driver; # added 2016-01-25
   saneBackends = sane-backends; # added 2016-01-02
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 4ed1c9577567..f2e6cb87013e 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -6179,8 +6179,6 @@ with pkgs;
   rust = callPackage ../development/compilers/rust { };
   inherit (rust) cargo rustc;
 
-  rustRegistry = callPackage ./rust-packages.nix { };
-
   rustPlatform = recurseIntoAttrs (makeRustPlatform rust);
 
   makeRustPlatform = rust: lib.fix (self:
diff --git a/pkgs/top-level/rust-packages.nix b/pkgs/top-level/rust-packages.nix
deleted file mode 100644
index 92230993d58f..000000000000
--- a/pkgs/top-level/rust-packages.nix
+++ /dev/null
@@ -1,46 +0,0 @@
-# This file defines the source of Rust / cargo's crates registry
-#
-# buildRustPackage will automatically download dependencies from the registry
-# version that we define here. If you're having problems downloading / finding
-# a Rust library, try updating this to a newer commit.
-
-{ stdenv, fetchFromGitHub, git }:
-
-stdenv.mkDerivation {
-  name = "rustRegistry-2017-10-08";
-
-  src = fetchFromGitHub {
-    owner = "rust-lang";
-    repo = "crates.io-index";
-    rev = "78ab44cf22c2ce5d40e562ffc7df7ab10ac12b86";
-    sha256 = "0fa3l3px6b89ap63h40bhn2x50zf5j65jrgbb7j103j0cdayk2l0";
-  };
-  phases = [ "unpackPhase" "installPhase" ];
-  installPhase = ''
-    # For some reason, cargo doesn't like fetchgit's git repositories, not even
-    # if we set leaveDotGit to true, set the fetchgit branch to 'master' and clone
-    # the repository (tested with registry rev
-    # 965b634156cc5c6f10c7a458392bfd6f27436e7e), failing with the message:
-    #
-    # "Target OID for the reference doesn't exist on the repository"
-    #
-    # So we'll just have to create a new git repository from scratch with the
-    # contents downloaded with fetchgit...
-
-    mkdir -p $out
-
-    cp -r ./* $out/
-
-    cd $out
-
-    git="${git}/bin/git"
-
-    $git init
-    $git config --local user.email "example@example.com"
-    $git config --local user.name "example"
-    $git add .
-    $git commit --quiet -m 'Rust registry commit'
-
-    touch $out/touch . "$out/.cargo-index-lock"
-  '';
-}