-
-
Save matklad/6b15896caccc443865fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> {}; | |
assert stdenv.isLinux; | |
let build = {name, url, sha256, exes} : | |
stdenv.mkDerivation rec { | |
inherit name; | |
src = fetchurl { | |
inherit url sha256; | |
}; | |
dontStrip = true; | |
installPhase = '' | |
mv ${name} $out | |
rm $out/manifest.in | |
''; | |
preFixup = let | |
rpath = stdenv.lib.concatStringsSep ":" [ | |
"$out/lib" | |
(stdenv.lib.makeLibraryPath [ zlib ]) | |
''${stdenv.cc.cc}/lib64'' | |
]; | |
in | |
'' | |
for executable in ${stdenv.lib.concatMapStringsSep " " (s: "$out/bin/" + s) exes}; do | |
patchelf --interpreter "${stdenv.glibc}/lib/${stdenv.cc.dynamicLinker}" \ | |
--set-rpath "${rpath}" \ | |
"$executable" | |
done | |
for library in $out/lib/*.so $cargo/lib/*.so; do | |
patchelf --set-rpath "${rpath}" "$library" | |
done | |
''; | |
}; | |
in | |
{ | |
rust = build { | |
name = "rustc"; | |
# Version 1.5 gives "error: can't find crate for `std` [E0463]" | |
url = https://static.rust-lang.org/dist/rust-1.5.0-x86_64-unknown-linux-gnu.tar.gz; | |
sha256 = "60b83f74d882ce2ba5bc979b5b0589dca56659f215b3259e7188fed8c50aac9d"; | |
# Version 1.4 works fine | |
# url = https://static.rust-lang.org/dist/rust-1.4.0-x86_64-unknown-linux-gnu.tar.gz; | |
# sha256 = "07f5d91zbl4a8f20ilwajai0223j7kq6lns9gjkb6anaa15l5qid"; | |
exes = ["rustc" "rustdoc"]; | |
}; | |
cargo = build { | |
name = "cargo"; | |
url = https://static.rust-lang.org/cargo-dist/cargo-nightly-x86_64-unknown-linux-gnu.tar.gz; | |
sha256 = "0fv5cqzsrpm4vdjrrqsgldnx6vwy3pks5n2ashmvzy8y1r1h13i2"; | |
exes = [ "cargo" ]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment