[Nix-dev] Simple build tool for scala.

David Brown nix at davidb.org
Sat May 8 19:54:15 CEST 2010


This is my first attempt at a nix package, so I appreciate any
feedback.  SBT is a little unusual in that all that gets installed is
a small launcher.  Versions of SBT itself as well as the Scala
compiler are managed within each project directory.

Building the launcher itself from source isn't commonly done,
especially since sbt's build system uses sbt.

Thanks,
David

 From e940275e7f5f871151215f0c642d4da1f99ef03d Mon Sep 17 00:00:00 2001
From: David Brown <nix at davidb.org>
Date: Sat, 8 May 2010 10:43:26 -0700
Subject: [PATCH] Add simple-build-tool launcher.

---
  .../build-managers/simple-build-tool/default.nix   |   41 ++++++++++++++++++++
  pkgs/top-level/all-packages.nix                    |    4 ++
  2 files changed, 45 insertions(+), 0 deletions(-)
  create mode 100644 pkgs/development/tools/build-managers/simple-build-tool/default.nix

diff --git a/pkgs/development/tools/build-managers/simple-build-tool/default.nix b/pkgs/development/tools/build-managers/simple-build-tool/default.nix
new file mode 100644
index 0000000..218957a
--- /dev/null
+++ b/pkgs/development/tools/build-managers/simple-build-tool/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl }:
+
+# Depends on a JRE at runtime.
+
+let
+  version = "0.7.3";
+in
+  stdenv.mkDerivation rec {
+    name = "simple-build-tool-${version}";
+    src = fetchurl {
+      url = "http://simple-build-tool.googlecode.com/files/sbt-launch-${version}.jar";
+      sha256 = "1nciifzf00cs54a4h57a7v1hyklm5vgln0sscmz5kzv96ggphs6k";
+    };
+
+    installPhase = ''
+      mkdir -pv "$out/lib/java"
+      cp $src "$out/lib/java/sbt-launch-${version}.jar"
+      mkdir -p "$out/bin"
+      cat > "$out/bin/sbt" <<EOF
+      #! /bin/sh
+      exec java -jar $out/lib/java/sbt-launch-${version}.jar "\$@"
+      EOF
+      chmod u+x "$out/bin/sbt"
+    '';
+
+    phases = "installPhase";
+
+    meta = {
+      description = "A build tool for Scala";
+      longDescription = ''
+        sbt is a simple build tool for Scala projects that aims to do the
+        basics well.
+
+	This package is the sbt launcher which automatically manages
+	and downloads dependencies, including the SBT package and the
+	Scala compiler.
+      '';
+      homepage = http://code.google.com/p/simple-build-tool/;
+      license = "bsd";
+    };
+  }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index f34a369..e13a39a 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3327,6 +3327,10 @@ let
      inherit fetchurl stdenv python makeWrapper;
    };
  
+  simpleBuildTool = import ../development/tools/build-managers/simple-build-tool {
+    inherit fetchurl stdenv;
+  };
+
    sloccount = import ../development/tools/misc/sloccount {
      inherit fetchurl stdenv perl;
    };
-- 
1.7.1




More information about the nix-dev mailing list