From 210452979adb21355f1a2c5dbcc16608713f9929 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 30 Jul 2014 06:00:56 +0200 Subject: [PATCH] rust: Prepare for more versions part 1: - Factor out some things that REALLY shouldn't change between versions --- pkgs/development/compilers/rust/common.nix | 32 ++++++++++++++++ pkgs/development/compilers/rust/default.nix | 42 ++++++++------------- 2 files changed, 48 insertions(+), 26 deletions(-) create mode 100644 pkgs/development/compilers/rust/common.nix diff --git a/pkgs/development/compilers/rust/common.nix b/pkgs/development/compilers/rust/common.nix new file mode 100644 index 000000000000..4ba6f159b4ce --- /dev/null +++ b/pkgs/development/compilers/rust/common.nix @@ -0,0 +1,32 @@ +{stdenv, version}: + +{ + inherit version; + + platform = if stdenv.system == "i686-linux" + then "linux-i386" + else if stdenv.system == "x86_64-linux" + then "linux-x86_64" + else if stdenv.system == "x86_64-darwin" + then "macos-x86_64" + else abort "no snapshot to boostrap for this platform (missing platform url suffix)"; + + target = if stdenv.system == "i686-linux" + then "i686-unknown-linux-gnu" + else if stdenv.system == "x86_64-linux" + then "x86_64-unknown-linux-gnu" + else if stdenv.system == "x86_64-darwin" + then "x86_64-apple-darwin" + else abort "no snapshot to boostrap for this platform (missing target triple"; + + meta = with stdenv.lib; { + homepage = http://www.rust-lang.org/; + description = "A safe, concurrent, practical language"; + maintainers = with maintainers; [ madjar cstrahan ]; + license = map (builtins.getAttr "shortName") [ licenses.mit 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" ]; + }; + + name = "rust-${version}"; +} diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix index 2c27cf778a14..c2696bae922b 100644 --- a/pkgs/development/compilers/rust/default.nix +++ b/pkgs/development/compilers/rust/default.nix @@ -14,23 +14,23 @@ */ -with if stdenv.system == "i686-linux" then { - platform = "linux-i386"; - snapshot = "84339ea0f796ae468ef86797ef4587274bec19ea"; - target = "i686-unknown-linux-gnu"; -} else if stdenv.system == "x86_64-linux" then { - platform = "linux-x86_64"; - snapshot = "bd8a6bc1f28845b7f4b768f6bfa06e7fbdcfcaae"; - target = "x86_64-unknown-linux-gnu"; -} else if stdenv.system == "x86_64-darwin" then { - platform = "macos-x86_64"; - snapshot = "4a8c2e1b7634d73406bac32a1a97893ec3ed818d"; -} else {}; -let snapshotDate = "2014-06-21"; +with ((import ./common.nix) {inherit stdenv; version = "0.11.0"; }); + +let snapshot = if stdenv.system == "i686-linux" + then "84339ea0f796ae468ef86797ef4587274bec19ea" + else if stdenv.system == "x86_64-linux" + then "bd8a6bc1f28845b7f4b768f6bfa06e7fbdcfcaae" + else if stdenv.system == "x86_64-darwin" + then "4a8c2e1b7634d73406bac32a1a97893ec3ed818d" + else abort "no-snapshot for platform ${stdenv.system}"; + snapshotDate = "2014-06-21"; snapshotRev = "db9af1d"; - snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshot}.tar.bz2"; in -stdenv.mkDerivation { - name = "rust-0.11.0"; + snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshot}.tar.bz2"; + +in stdenv.mkDerivation { + inherit name; + inherit version; + inherit meta; src = fetchurl { url = http://static.rust-lang.org/dist/rust-0.11.0.tar.gz; @@ -67,14 +67,4 @@ stdenv.mkDerivation { buildInputs = [ which file perl curl python27 makeWrapper ]; enableParallelBuilding = true; - - meta = with stdenv.lib; { - homepage = http://www.rust-lang.org/; - description = "A safe, concurrent, practical language"; - maintainers = with maintainers; [ madjar cstrahan ]; - license = map (builtins.getAttr "shortName") [ licenses.mit 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" ]; - }; } -