From b4d91e7904423b6477eb1f25b8cc3940e197e9c2 Mon Sep 17 00:00:00 2001 From: Astro Date: Fri, 15 Jan 2021 00:52:22 +0100 Subject: [PATCH] nix/rust-platform: remove rustcSrc which had to be kept in sync --- default.nix | 2 +- nix/rust-platform.nix | 14 +++++--------- shell.nix | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/default.nix b/default.nix index 9358eba..9e8aef8 100644 --- a/default.nix +++ b/default.nix @@ -15,7 +15,7 @@ let nativeBuildInputs = [ cargo-xbuild ]; buildPhase = '' - export XARGO_RUST_SRC="${rustPlatform.rust.rustc.src}/library" + export XARGO_RUST_SRC="${rustPlatform.rust.rustc}/lib/rustlib/src/rust/library" export CARGO_HOME=$(mktemp -d cargo-home.XXX) pushd ${crate} cargo xbuild --release --frozen \ diff --git a/nix/rust-platform.nix b/nix/rust-platform.nix index 2345080..dedae52 100644 --- a/nix/rust-platform.nix +++ b/nix/rust-platform.nix @@ -1,24 +1,20 @@ { pkgs }: let - rustcSrc = pkgs.fetchgit { - url = "https://github.com/rust-lang/rust.git"; - # sync with git_commit_hash from pkg.rust in channel-rust-nightly.toml - rev = "8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306"; - sha256 = "1c9wdwqvskchiqkxqnl516z2yajs2nbs31y4j6m2jz945dj8x4xc"; - fetchSubmodules = true; - }; rustManifest = ./channel-rust-nightly.toml; targets = []; rustChannelOfTargets = _channel: _date: targets: (pkgs.lib.rustLib.fromManifestFile rustManifest { inherit (pkgs) stdenv fetchurl patchelf; - }).rust.override { inherit targets; }; + }).rust.override { + inherit targets; + extensions = ["rust-src"]; + }; rust = rustChannelOfTargets "nightly" null targets; in pkgs.recurseIntoAttrs (pkgs.makeRustPlatform { - rustc = rust // { src = rustcSrc; }; + rustc = rust; cargo = rust; }) diff --git a/shell.nix b/shell.nix index 1ef6793..b733ad7 100644 --- a/shell.nix +++ b/shell.nix @@ -17,7 +17,7 @@ in (import ./nix/mkbootimage.nix { inherit pkgs; }) ]; - XARGO_RUST_SRC = "${rustPlatform.rust.rustc.src}/library"; + XARGO_RUST_SRC = "${rustPlatform.rust.rustc}/lib/rustlib/src/rust/library"; shellHook = '' echo "Run 'cargo xbuild --release -p ...' to build."