about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2014-01-19 12:39:17 -0500
committerShea Levy <shea@shealevy.com>2014-01-19 12:39:17 -0500
commit4b9da6697bc78fb2786f2be9a1c5507725c8a3f7 (patch)
treefd4c723ffd4967dc131e38f3a361506d3a913907 /pkgs
parentd7bf8677a3e23a318d1649be16aa6d518980d2ed (diff)
parent2a0f1cd6f155a58164ac47a8a3b8270e05e62070 (diff)
downloadnixlib-4b9da6697bc78fb2786f2be9a1c5507725c8a3f7.tar
nixlib-4b9da6697bc78fb2786f2be9a1c5507725c8a3f7.tar.gz
nixlib-4b9da6697bc78fb2786f2be9a1c5507725c8a3f7.tar.bz2
nixlib-4b9da6697bc78fb2786f2be9a1c5507725c8a3f7.tar.lz
nixlib-4b9da6697bc78fb2786f2be9a1c5507725c8a3f7.tar.xz
nixlib-4b9da6697bc78fb2786f2be9a1c5507725c8a3f7.tar.zst
nixlib-4b9da6697bc78fb2786f2be9a1c5507725c8a3f7.zip
Merge branch 'master' of git://github.com/madjar/nixpkgs
rust: Add

Signed-off-by: Shea Levy <shea@shealevy.com>
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/compilers/rust/default.nix51
-rw-r--r--pkgs/top-level/all-packages.nix3
2 files changed, 52 insertions, 2 deletions
diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix
new file mode 100644
index 000000000000..98573ab7dc91
--- /dev/null
+++ b/pkgs/development/compilers/rust/default.nix
@@ -0,0 +1,51 @@
+{stdenv, fetchurl, which, file, perl, curl, python27, makeWrapper}:
+
+let snapshotName = "rust-stage0-2014-01-05-a6d3e57-linux-x86_64-aa8fbbacdb1d8a078f3a3fe3478dcbc506bd4090.tar.bz2"; in
+stdenv.mkDerivation {
+  name = "rust-0.9";
+  
+  src = fetchurl {
+    url = http://static.rust-lang.org/dist/rust-0.9.tar.gz;
+    sha256 = "1lfmgnn00wrc30nf5lgg52w58ir3xpsnpmzk2v5a35xp8lsir4f0";
+  };
+
+  # We need rust to build rust. If we don't provide it, configure will try to download it
+  snapshot = fetchurl {
+    url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}";
+    sha256 = "17inc23jpznqp0vnskvznm74mm24c1nffhz2bkadhvp2ww0vpjjx";
+  };
+
+  # Put the snapshot where it is expected
+  postUnpack = ''
+    mkdir $sourceRoot/dl
+    ln -s $snapshot $sourceRoot/dl/${snapshotName}
+  '';
+
+  # Modify the snapshot compiler so that is can be executed
+  preBuild = ''
+    make x86_64-unknown-linux-gnu/stage0/bin/rustc
+    patchelf --interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 \
+             --set-rpath ${stdenv.gcc.gcc}/lib/ \
+             x86_64-unknown-linux-gnu/stage0/bin/rustc
+  '';
+
+  # rustc requires cc
+  postInstall = ''
+    for f in $out/bin/*; do
+      wrapProgram $f --prefix PATH : "${stdenv.gcc}/bin"
+    done
+  '';
+
+  buildInputs = [ which file perl curl python27 makeWrapper];
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = http://www.rust-lang.org/;
+    description = "A safe, concurrent, practical language";
+    maintainers = [ stdenv.lib.maintainers.madjar ];
+    license = map (builtins.getAttr "shortName") [stdenv.lib.licenses.mit stdenv.lib.licenses.asl20 ];
+    # platforms as per http://static.rust-lang.org/doc/master/tutorial.html#getting-started
+    platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin"];
+  };
+}
+
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 4f739221bc16..5f13dde8cd86 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3106,8 +3106,7 @@ let
 
   roadsend = callPackage ../development/compilers/roadsend { };
 
-  # TODO: the corresponding nix file is missing
-  # rust = pkgsi686Linux.callPackage ../development/compilers/rust {};
+  rust = callPackage ../development/compilers/rust {};
 
   sbcl = builderDefsPackage (import ../development/compilers/sbcl) {
     inherit makeWrapper;