Skip to content

Instantly share code, notes, and snippets.

@alpakido
Created Jul 23, 2019
Embed
What would you like to do?
{ pkgs ? import ./pkgs.nix {} }:
with pkgs.pkgsStatic;
let
fetchCargo = callPackage <nixpkgs/pkgs/build-support/rust/fetchcargo.nix>;
rustBeta = with buildPackages; rust.packages.stable.overrideScope' (final: previous: {
cargo = (previous.cargo.override {
inherit (rust.packages.stable) rustPlatform;
}).overrideAttrs (super: rec {
preConfigure = "ln -s ${final.rustc.vendor} vendor";
});
cargo-vendor = runCommand "cargo-vendor" { buildInputs = [ makeWrapper ]; } ''
makeWrapper ${final.cargo}/bin/cargo $out/bin/cargo-vendor --add-flags vendor
'';
rustc = (previous.rustc.override {
inherit (rust.packages.stable) rustPlatform;
}).overrideAttrs (super: rec {
name = "rustc-${version}";
version = "1.37.0-beta-2019-07-12";
src = fetchFromGitHub {
owner = "rust-lang";
repo = "rust";
rev = "2ba6de7e28692578b33251e73fc6f8ae6da41336";
sha256 = "0wrh1jh9hl87wa7nq6giphlk7ybjlb41g2b832qaskk7fyva5mdn";
fetchSubmodules = true;
};
preConfigure = "ln -s ${vendor} vendor";
vendor = fetchCargo {} {
inherit src;
sha256 = "16y4q56v5nn3r4zljnxlq3x443dcnzvzahv5psnp18cin24qmifx";
patches = [];
sourceRoot = "";
srcs = [];
};
});
rustPlatform = rust.makeRustPlatform rustBeta;
});
rustNightly = rust.packages.stable.overrideScope' (final: previous: {
cargo = (previous.cargo.override {
inherit (rustBeta) rustPlatform;
}).overrideAttrs (super: {
preConfigure = "ln -s ${final.rustc.vendor} vendor";
});
rustc = (previous.rustc.override {
inherit (rustBeta) rustPlatform;
}).overrideAttrs (super: rec {
name = "rustc-${version}";
version = "nightly-2019-07-14";
# rustbook pulls in openssl-sys, likely fixed in newer nightlies
nativeBuildInputs = (super.nativeBuildInputs or []) ++ [ pkgconfig ];
buildInputs = (super.buildInputs or []) ++ [ openssl ];
src = fetchFromGitHub {
owner = "rust-lang";
repo = "rust";
rev = "2ce227dcc6213947b0dab34cc4139b80525670db";
sha256 = "08ykh9fh5rpc8yqmg6dl2df7cs5qqnsfarr0vjwdkp8yqw451y94";
fetchSubmodules = true;
};
vendor = fetchCargo rec {
inherit (rustBeta) cargo cargo-vendor;
} {
inherit src;
sha256 = "0l9azdywlgkvvp9l3926lcpi6hibgm5sgjnc82f023kgrckzbas4";
patches = [];
sourceRoot = "";
srcs = [];
};
preConfigure = "ln -s ${vendor} vendor";
doCheck = false;
patches = [];
});
});
in
rustNightly.rustc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment