diff --git a/doc/languages-frameworks/rust.md b/doc/languages-frameworks/rust.md index 481b76fb78f2..276b5496fbb8 100644 --- a/doc/languages-frameworks/rust.md +++ b/doc/languages-frameworks/rust.md @@ -9,16 +9,15 @@ date: 2017-03-05 To install the rust compiler and cargo put ``` -rustStable.rustc -rustStable.cargo +rust ``` -into the `environment.systemPackages` or bring them into scope with -`nix-shell -p rustStable.rustc -p rustStable.cargo`. +into the `environment.systemPackages` or bring them into +scope with `nix-shell -p rust`. -There are also `rustBeta` and `rustNightly` package sets available. -These are not updated very regularly. For daily builds use either rustup from -nixpkgs or use the [Rust nightlies overlay](#using-the-rust-nightlies-overlay). +For daily builds (beta and nightly) use either rustup from +nixpkgs or use the [Rust nightlies +overlay](#using-the-rust-nightlies-overlay). ## Packaging Rust applications @@ -38,7 +37,7 @@ buildRustPackage rec { sha256 = "0y5d1n6hkw85jb3rblcxqas2fp82h3nghssa4xqrhqnz25l799pj"; }; - depsSha256 = "0q68qyl2h6i0qsz82z840myxlnjay8p1w5z7hfyr8fqp7wgwa9cx"; + cargoSha256 = "0q68qyl2h6i0qsz82z840myxlnjay8p1w5z7hfyr8fqp7wgwa9cx"; meta = with stdenv.lib; { description = "A utility that combines the usability of The Silver Searcher with the raw speed of grep"; @@ -50,7 +49,7 @@ buildRustPackage rec { } ``` -`buildRustPackage` requires a `depsSha256` attribute which is computed over +`buildRustPackage` requires a `cargoSha256` attribute which is computed over all crate sources of this package. Currently it is obtained by inserting a fake checksum into the expression and building the package once. The correct checksum can be then take from the failed build. @@ -76,11 +75,11 @@ in the `~/.config/nixpkgs/overlays` directory. The latest version can be installed with the following command: - $ nix-env -Ai nixos.rustChannels.stable.rust + $ nix-env -Ai nixos.latest.rustChannels.stable.rust Or using the attribute with nix-shell: - $ nix-shell -p nixos.rustChannels.stable.rust + $ nix-shell -p nixos.latest.rustChannels.stable.rust To install the beta or nightly channel, "stable" should be substituted by "nightly" or "beta", or 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 < 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 < $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 < $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 --precise ' 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) - fetchCargoDeps . "$out" + cargo vendor + + cp -ar vendor $out ''; outputHashAlgo = "sha256"; diff --git a/pkgs/development/compilers/rust/beta.nix b/pkgs/development/compilers/rust/beta.nix deleted file mode 100644 index 876c54a298b4..000000000000 --- a/pkgs/development/compilers/rust/beta.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ stdenv, callPackage, recurseIntoAttrs, makeRustPlatform, llvm, fetchurl -, targets ? [] -, targetToolchains ? [] -, targetPatches ? [] -}: - -let - rustPlatform = recurseIntoAttrs (makeRustPlatform (callPackage ./bootstrap.nix {})); -in -rec { - rustc = callPackage ./rustc.nix { - inherit llvm targets targetPatches targetToolchains rustPlatform; - - version = "beta-2017-05-27"; - - configureFlags = [ "--release-channel=beta" ]; - - src = fetchurl { - url = "https://static.rust-lang.org/dist/2017-05-27/rustc-beta-src.tar.gz"; - sha256 = "9f3f92efef7fb2b4bf38e57e4ff1f416dc221880b90841c4bdaee350801c0b57"; - }; - - patches = [ - ./patches/darwin-disable-fragile-tcp-tests.patch - ] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; - - doCheck = false; - broken = true; - }; - - cargo = callPackage ./cargo.nix rec { - version = "0.18.0"; - srcRev = "fe7b0cdcf5ca7aab81630706ce40b70f6aa2e666"; - srcSha = "164iywv1l3v87b0pznf5kkzxigd6w19myv9d7ka4c65zgrk9n9px"; - depsSha256 = "1mrgd8ib48vxxbhkvsqqq4p19sc6b74x3cd8p6lhhlm6plrajrvm"; - - inherit rustc; # the rustc that will be wrapped by cargo - inherit rustPlatform; # used to build cargo - }; -} diff --git a/pkgs/development/compilers/rust/bootstrap.nix b/pkgs/development/compilers/rust/bootstrap.nix index ad49b1305706..fbcac09fc458 100644 --- a/pkgs/development/compilers/rust/bootstrap.nix +++ b/pkgs/development/compilers/rust/bootstrap.nix @@ -1,6 +1,18 @@ { stdenv, fetchurl, makeWrapper, cacert, zlib, curl }: let + # Note: the version MUST be one version prior to the version we're + # building + version = "1.19.0"; + + # fetch hashes by running `print-hashes.sh 1.19.0` + hashes = { + i686-unknown-linux-gnu = "657b78f3c1a1b4412e12f7278e20cc318022fa276a58f0d38a0d15b515e39713"; + x86_64-unknown-linux-gnu = "30ff67884464d32f6bbbde4387e7557db98868e87fb2afbb77c9b7716e3bff09"; + i686-apple-darwin = "bdfd2189245dc5764c9f26bdba1429c2bf9d57477d8e6e3f0ba42ea0dc63edeb"; + x86_64-apple-darwin = "5c668fb60a3ba3e97dc2cb8967fc4bb9422b629155284dcb89f94d116bb17820"; + }; + platform = if stdenv.system == "i686-linux" then "i686-unknown-linux-gnu" @@ -12,27 +24,11 @@ let then "x86_64-apple-darwin" else throw "missing bootstrap url for platform ${stdenv.system}"; - # fetch hashes by patching print-hashes.sh to not use the "$DATE" variable - # then running `print-hashes.sh 1.16.0` - bootstrapHash = - if stdenv.system == "i686-linux" - then "b5859161ebb182d3b75fa14a5741e5de87b088146fb0ef4a30f3b2439c6179c5" - else if stdenv.system == "x86_64-linux" - then "48621912c242753ba37cad5145df375eeba41c81079df46f93ffb4896542e8fd" - else if stdenv.system == "i686-darwin" - then "26356b14164354725bd0351e8084f9b164abab134fb05cddb7758af35aad2065" - else if stdenv.system == "x86_64-darwin" - then "2d08259ee038d3a2c77a93f1a31fc59e7a1d6d1bbfcba3dba3c8213b2e5d1926" - else throw "missing bootstrap hash for platform ${stdenv.system}"; - src = fetchurl { url = "https://static.rust-lang.org/dist/rust-${version}-${platform}.tar.gz"; - sha256 = bootstrapHash; + sha256 = hashes."${platform}"; }; - # Note: the version MUST be one version prior to the version we're - # building - version = "1.16.0"; in import ./binaryBuild.nix { inherit stdenv fetchurl makeWrapper cacert zlib curl; buildRustPackage = null; diff --git a/pkgs/development/compilers/rust/cargo.nix b/pkgs/development/compilers/rust/cargo.nix index 97977ba3ed3a..ec890b3bf7a2 100644 --- a/pkgs/development/compilers/rust/cargo.nix +++ b/pkgs/development/compilers/rust/cargo.nix @@ -1,19 +1,20 @@ -{ stdenv, fetchgit, file, curl, pkgconfig, python, openssl, cmake, zlib +{ stdenv, fetchFromGitHub, file, curl, pkgconfig, python, openssl, cmake, zlib , makeWrapper, libiconv, cacert, rustPlatform, rustc, libgit2 -, version, srcRev, srcSha, depsSha256 +, version, srcSha, cargoSha256 , patches ? []}: rustPlatform.buildRustPackage rec { name = "cargo-${version}"; inherit version; - src = fetchgit { - url = "https://github.com/rust-lang/cargo"; - rev = srcRev; + src = fetchFromGitHub { + owner = "rust-lang"; + repo = "cargo"; + rev = version; 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 0d7e26e06f47..c42c958b170c 100644 --- a/pkgs/development/compilers/rust/default.nix +++ b/pkgs/development/compilers/rust/default.nix @@ -6,30 +6,31 @@ let rustPlatform = recurseIntoAttrs (makeRustPlatform (callPackage ./bootstrap.nix {})); - version = "1.17.0"; + version = "1.20.0"; in rec { rustc = callPackage ./rustc.nix { inherit llvm targets targetPatches targetToolchains rustPlatform version; + forceBundledLLVM = true; + configureFlags = [ "--release-channel=stable" ]; src = fetchurl { url = "https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz"; - sha256 = "4baba3895b75f2492df6ce5a28a916307ecd1c088dc1fd02dbfa8a8e86174f87"; + sha256 = "0542y4rnzlsrricai130mqyxl8r6rd991frb4qsnwb27yigqg91a"; }; 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; }; cargo = callPackage ./cargo.nix rec { - version = "0.18.0"; - srcRev = "fe7b0cdcf5ca7aab81630706ce40b70f6aa2e666"; - srcSha = "164iywv1l3v87b0pznf5kkzxigd6w19myv9d7ka4c65zgrk9n9px"; - depsSha256 = "1mrgd8ib48vxxbhkvsqqq4p19sc6b74x3cd8p6lhhlm6plrajrvm"; + version = "0.22.0"; + srcSha = "0x9pm73hkkd1hq4qrmz8iv91djgpdsxzwll7jari0h77vpwajmw4"; + cargoSha256 = "0xd0rb8gcqy6xngsx9l30jg3fqrcwccgv904ksqs9c4d44hga0gd"; inherit rustc; # the rustc that will be wrapped by cargo inherit rustPlatform; # used to build cargo diff --git a/pkgs/development/compilers/rust/nightly.nix b/pkgs/development/compilers/rust/nightly.nix deleted file mode 100644 index 37a234ea129e..000000000000 --- a/pkgs/development/compilers/rust/nightly.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ stdenv, callPackage, rustPlatform, llvm, fetchurl -, targets ? [] -, targetToolchains ? [] -, targetPatches ? [] -}: - -rec { - rustc = callPackage ./rustc.nix { - inherit llvm targets targetPatches targetToolchains rustPlatform; - - version = "nightly-2017-05-30"; - - configureFlags = [ "--release-channel=nightly" ]; - - src = fetchurl { - url = "https://static.rust-lang.org/dist/2017-05-30/rustc-nightly-src.tar.gz"; - sha256 = "90ce76db56a93f1b4532f2e62bbf12c243c4d156662b0d80c25319211ee7d0e0"; - }; - - patches = [ - ./patches/darwin-disable-fragile-tcp-tests.patch - ] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; - - doCheck = false; - broken = true; - }; - - cargo = callPackage ./cargo.nix rec { - version = "0.18.0"; - srcRev = "fe7b0cdcf5ca7aab81630706ce40b70f6aa2e666"; - srcSha = "164iywv1l3v87b0pznf5kkzxigd6w19myv9d7ka4c65zgrk9n9px"; - depsSha256 = "1mrgd8ib48vxxbhkvsqqq4p19sc6b74x3cd8p6lhhlm6plrajrvm"; - - inherit rustc; # the rustc that will be wrapped by cargo - inherit rustPlatform; # used to build cargo - }; -} diff --git a/pkgs/development/compilers/rust/nightlyBin.nix b/pkgs/development/compilers/rust/nightlyBin.nix deleted file mode 100644 index af06835c5def..000000000000 --- a/pkgs/development/compilers/rust/nightlyBin.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ stdenv, fetchurl, makeWrapper, cacert, zlib, buildRustPackage, curl }: - -let - platform = if stdenv.system == "x86_64-linux" - then "x86_64-unknown-linux-gnu" - else throw "missing bootstrap url for platform ${stdenv.system}"; - - bootstrapHash = - if stdenv.system == "x86_64-linux" - then "0svlm4bxsdhdn4jsv46f278kid23a9w978q2137qrba4xnyb06kf" - else throw "missing bootstrap hash for platform ${stdenv.system}"; - - src = fetchurl { - url = "https://static.rust-lang.org/dist/${version}/rust-nightly-${platform}.tar.gz"; - sha256 = bootstrapHash; - }; - - version = "2017-06-26"; -in import ./binaryBuild.nix - { inherit stdenv fetchurl makeWrapper cacert zlib buildRustPackage curl; - inherit version src platform; - versionType = "nightly"; - } 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 similarity index 55% rename from pkgs/development/compilers/rust/patches/darwin-disable-fragile-tcp-tests.patch rename to 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 -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 +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 --- - 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/compilers/rust/patches/disable-lockfile-check-beta.patch b/pkgs/development/compilers/rust/patches/disable-lockfile-check-beta.patch deleted file mode 100644 index a6fe3413fd21..000000000000 --- a/pkgs/development/compilers/rust/patches/disable-lockfile-check-beta.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 5702d7cdb2bed7ac3af3c01087b181da35f6e108 Mon Sep 17 00:00:00 2001 -From: joachim schiele -Date: Thu, 24 Nov 2016 22:25:48 +0100 -Subject: [PATCH 2/2] asdf - ---- - src/tools/tidy/src/main.rs | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs -index cabaee5..685df94 100644 ---- a/src/tools/tidy/src/main.rs -+++ b/src/tools/tidy/src/main.rs -@@ -48,7 +48,7 @@ fn main() { - errors::check(&path, &mut bad); - cargo::check(&path, &mut bad); - features::check(&path, &mut bad); -- cargo_lock::check(&path, &mut bad); -+ //cargo_lock::check(&path, &mut bad); - pal::check(&path, &mut bad); - - if bad { --- -2.10.0 - diff --git a/pkgs/development/compilers/rust/patches/disable-lockfile-check-nightly.patch b/pkgs/development/compilers/rust/patches/disable-lockfile-check-nightly.patch deleted file mode 100644 index c89d22dcb1ea..000000000000 --- a/pkgs/development/compilers/rust/patches/disable-lockfile-check-nightly.patch +++ /dev/null @@ -1,25 +0,0 @@ -From ac204f8be95cdb2350a1dd893641e38528aaf01d Mon Sep 17 00:00:00 2001 -From: joachim schiele -Date: Fri, 25 Nov 2016 02:17:02 +0100 -Subject: [PATCH] asdf - ---- - src/tools/tidy/src/main.rs | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs -index cb11fe2..c9b7d2a 100644 ---- a/src/tools/tidy/src/main.rs -+++ b/src/tools/tidy/src/main.rs -@@ -45,7 +45,7 @@ fn main() { - bins::check(&path, &mut bad); - style::check(&path, &mut bad); - errors::check(&path, &mut bad); -- cargo::check(&path, &mut bad); -+ //cargo::check(&path, &mut bad); - features::check(&path, &mut bad); - pal::check(&path, &mut bad); - --- -2.10.0 - diff --git a/pkgs/development/compilers/rust/print-hashes.sh b/pkgs/development/compilers/rust/print-hashes.sh index da52ac37ab30..f3d094d65a8a 100755 --- a/pkgs/development/compilers/rust/print-hashes.sh +++ b/pkgs/development/compilers/rust/print-hashes.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail # All rust-related downloads can be found at # https://static.rust-lang.org/dist/index.html. To find the date on @@ -6,25 +7,30 @@ # file, e.g. # https://static.rust-lang.org/dist/channel-rust-beta-date.txt -PLATFORMS="i686-unknown-linux-gnu x86_64-unknown-linux-gnu i686-apple-darwin x86_64-apple-darwin" -BASEURL="https://static.rust-lang.org/dist" -DATE=$1 -VERSION=$2 +PLATFORMS=( + i686-unknown-linux-gnu + x86_64-unknown-linux-gnu + i686-apple-darwin + x86_64-apple-darwin +) +BASEURL=https://static.rust-lang.org/dist +VERSION=${1:-} +DATE=${2:-} -if [[ -z $DATE ]] -then - echo "No date supplied" - exit -1 -fi - -if [[ -z $VERSION ]] +if [[ -z $VERSION ]] then echo "No version supplied" exit -1 fi -for PLATFORM in $PLATFORMS +if [[ -n $DATE ]] +then + BASEURL=$BASEURL/$DATE +fi + +for PLATFORM in "${PLATFORMS[@]}" do - URL="$BASEURL/$DATE/rust-$VERSION-$PLATFORM.tar.gz.sha256" - curl $URL + URL="$BASEURL/rust-$VERSION-$PLATFORM.tar.gz.sha256" + SHA256=$(curl -sSfL $URL | cut -d ' ' -f 1) + echo "$PLATFORM = \"$SHA256\";" done diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index 73d78319b8c7..6eb160add26e 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -48,15 +48,18 @@ stdenv.mkDerivation { configureFlags = configureFlags ++ [ "--enable-local-rust" "--local-rust-root=${rustPlatform.rust.rustc}" "--enable-rpath" ] ++ [ "--enable-vendor" "--disable-locked-deps" ] - ++ [ "--enable-llvm-link-shared" ] # ++ [ "--jemalloc-root=${jemalloc}/lib" ++ [ "--default-linker=${stdenv.cc}/bin/cc" "--default-ar=${binutils.out}/bin/ar" ] + ++ optional (!forceBundledLLVM) [ "--enable-llvm-link-shared" ] ++ optional (stdenv.cc.cc ? isClang) "--enable-clang" ++ optional (targets != []) "--target=${target}" ++ optional (!forceBundledLLVM) "--llvm-root=${llvmShared}"; patches = patches ++ targetPatches; + # the rust build system complains that nix alters the checksums + dontFixLibtool = true; + passthru.target = target; postPatch = '' 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 ab2d1dd75c02..f2e6cb87013e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6175,33 +6175,9 @@ with pkgs; inherit (darwin) apple_sdk; }; - rustRegistry = callPackage ./rust-packages.nix { }; - - rust = rustStable; - rustStable = callPackage ../development/compilers/rust { - inherit (llvmPackages_4) llvm; - }; - rustBeta = lowPrio (recurseIntoAttrs (callPackage ../development/compilers/rust/beta.nix {})); - - rustNightly = rustBeta; - - # rust support in nixpkgs isn't yet well maintained enough for us to - # pretend to support nightlies in a meaningful way. - - # rustNightly = lowPrio (recurseIntoAttrs (callPackage ../development/compilers/rust/nightly.nix { - # rustPlatform = recurseIntoAttrs (makeRustPlatform rustBeta); - # })); - - rustNightlyBin = lowPrio (callPackage ../development/compilers/rust/nightlyBin.nix { - buildRustPackage = callPackage ../build-support/rust { - rust = rustNightlyBin; - }; - }); - - cargo = rust.cargo; - rustc = rust.rustc; - - cargo-edit = callPackage ../tools/package-management/cargo-edit { }; + # For beta and nightly releases use the nixpkgs-mozilla overlay + rust = callPackage ../development/compilers/rust { }; + inherit (rust) cargo rustc; rustPlatform = recurseIntoAttrs (makeRustPlatform rust); @@ -6224,6 +6200,8 @@ with pkgs; }); + cargo-edit = callPackage ../tools/package-management/cargo-edit { }; + rainicorn = callPackage ../development/tools/rust/rainicorn { }; rustfmt = callPackage ../development/tools/rust/rustfmt { }; rustracer = callPackage ../development/tools/rust/racer { }; 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" - ''; -}