about summary refs log tree commit diff
diff options
context:
space:
mode:
authorwyvie <elijahrum@gmail.com>2014-09-19 21:40:37 +0200
committerDomen Kožar <domen@dev.si>2014-09-23 13:56:45 +0200
commite6eb51496b966d10e9fc1a00770417dbb25f001c (patch)
tree78252953ca00bf501a48b8a32c68534b257d8ec8
parent0bc83f656a06188b2c02d86674b8c3a1d69856d2 (diff)
downloadnixlib-e6eb51496b966d10e9fc1a00770417dbb25f001c.tar
nixlib-e6eb51496b966d10e9fc1a00770417dbb25f001c.tar.gz
nixlib-e6eb51496b966d10e9fc1a00770417dbb25f001c.tar.bz2
nixlib-e6eb51496b966d10e9fc1a00770417dbb25f001c.tar.lz
nixlib-e6eb51496b966d10e9fc1a00770417dbb25f001c.tar.xz
nixlib-e6eb51496b966d10e9fc1a00770417dbb25f001c.tar.zst
nixlib-e6eb51496b966d10e9fc1a00770417dbb25f001c.zip
Added luaPackages, moved lua sockets and lua filesystem to luaPackages, fixed mudlet deps
-rw-r--r--pkgs/development/lua-modules/generic/default.nix23
-rw-r--r--pkgs/games/mudlet/default.nix6
-rw-r--r--pkgs/top-level/all-packages.nix30
-rw-r--r--pkgs/top-level/lua-packages.nix52
4 files changed, 101 insertions, 10 deletions
diff --git a/pkgs/development/lua-modules/generic/default.nix b/pkgs/development/lua-modules/generic/default.nix
new file mode 100644
index 000000000000..f5ea77c2f143
--- /dev/null
+++ b/pkgs/development/lua-modules/generic/default.nix
@@ -0,0 +1,23 @@
+lua:
+
+{ buildInputs ? [], disabled ? false, ... } @ attrs:
+
+assert !disabled;
+
+lua.stdenv.mkDerivation ({
+
+    preBuild = ''
+      makeFlagsArray=(
+        PREFIX=$out
+        LUA_LIBDIR="$out/lib/lua/${lua.luaversion}"
+        LUA_INC="-I${lua}/include");
+    '';
+  }
+  //
+  attrs
+  //
+  {
+    name = "lua${lua.luaversion}-" + attrs.name;
+    buildInputs = buildInputs ++ [ lua ];
+  }
+)
diff --git a/pkgs/games/mudlet/default.nix b/pkgs/games/mudlet/default.nix
index 97f1d14a571f..a308e86fcf12 100644
--- a/pkgs/games/mudlet/default.nix
+++ b/pkgs/games/mudlet/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, pkgs, stdenv, makeWrapper, qt5, yajl, libzip, hunspell, lua5_1, boost, lua51_filesystem }:
+{ fetchurl, pkgs, stdenv, makeWrapper, qt5, yajl, libzip, hunspell, lua5_1, boost, fileSystem }:
 
 stdenv.mkDerivation rec {
   name = "mudlet-${version}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "c7b9a383d2cf393da730ce07ac8f06478eaec1fdf730054e837e58c598222d38";
   };
 
-  buildInputs = [ pkgs.unzip qt5 lua5_1 hunspell libzip yajl boost makeWrapper lua51_filesystem ];
+  buildInputs = [ pkgs.unzip qt5 lua5_1 hunspell libzip yajl boost makeWrapper fileSystem ];
 
   configurePhase = "cd src && qmake";
 
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
     # ln -s $out/mudlet $out/bin/mudlet
     makeWrapper $out/mudlet $out/bin/mudlet \
-      --set LUA_CPATH "${lua51_filesystem}/lib/lua/5.1/?.so"
+      --set LUA_CPATH "${fileSystem}/lib/lua/5.1/?.so"
   '';
 
   patches = [ ./libs.patch ];
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index a62db92f4905..c1a251b2a170 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3743,6 +3743,8 @@ let
   love_luajit = callPackage ../development/interpreters/love {lua=luajit;};
   love_0_9 = callPackage ../development/interpreters/love/0.9.nix { };
 
+  ### LUA MODULES
+
   lua4 = callPackage ../development/interpreters/lua-4 { };
   lua5_0 = callPackage ../development/interpreters/lua-5/5.0.3.nix { };
   lua5_1 = callPackage ../development/interpreters/lua-5/5.1.nix { };
@@ -3753,12 +3755,23 @@ let
   lua5 = lua5_2_compat;
   lua = lua5;
 
-  lua5_1_sockets = callPackage ../development/interpreters/lua-5/sockets.nix {
-    lua5 = lua5_1; # version 2.* only works with 5.1
-  };
+  lua51Packages = recurseIntoAttrs (import ./lua-packages.nix {
+    pkgs = pkgs // {
+      lua = lua5_1;
+    };
+  });
+
+  lua52Packages = recurseIntoAttrs (import ./lua-packages.nix {
+    pkgs = pkgs // {
+      lua = lua5_2;
+    };
+  });
+
+  luaPackages = lua52Packages;
+
+  lua5_1_sockets = lua51Packages.sockets;
+
   lua5_expat = callPackage ../development/interpreters/lua-5/expat.nix {};
-  lua5_filesystem = callPackage ../development/interpreters/lua-5/filesystem.nix {};
-  lua51_filesystem = lua5_filesystem.override { lua5=lua5_1; };
   lua51_zip = callPackage ../development/interpreters/lua-5/zip.nix { };
   lua5_sec = callPackage ../development/interpreters/lua-5/sec.nix { };
 
@@ -3768,6 +3781,8 @@ let
 
   luajit = callPackage ../development/interpreters/luajit {};
 
+  ### END OF LUA
+
   lush2 = callPackage ../development/interpreters/lush {};
 
   maude = callPackage ../development/interpreters/maude {
@@ -6898,7 +6913,6 @@ let
 
   planetary_annihilation = callPackage ../games/planetaryannihilation { };
 
-
   ### DEVELOPMENT / PYTHON MODULES
 
   # python function with default python interpreter
@@ -9686,7 +9700,9 @@ let
 
   mrxvt = callPackage ../applications/misc/mrxvt { };
 
-  mudlet = callPackage ../games/mudlet { };
+  mudlet = callPackage ../games/mudlet {
+    inherit (lua51Packages) fileSystem;
+  };
 
   multisync = callPackage ../applications/misc/multisync {
     inherit (gnome) ORBit2 libbonobo libgnomeui GConf;
diff --git a/pkgs/top-level/lua-packages.nix b/pkgs/top-level/lua-packages.nix
new file mode 100644
index 000000000000..c900044f407a
--- /dev/null
+++ b/pkgs/top-level/lua-packages.nix
@@ -0,0 +1,52 @@
+/* This file defines the composition for Lua packages.  It has
+   been factored out of all-packages.nix because there are many of
+   them.  Also, because most Nix expressions for Lua packages are
+   trivial, most are actually defined here.  I.e. there's no function
+   for each package in a separate file: the call to the function would
+   be almost as must code as the function itself. */
+
+{pkgs}:
+
+let self = _self; _self = with self; {
+
+  inherit (pkgs) fetchurl stdenv lua;
+
+  inherit (stdenv.lib) maintainers;
+
+  #define build lua package function
+  buildLuaPackage = import ../development/lua-modules/generic lua;
+
+  fileSystem = buildLuaPackage {
+    name = "filesystem-1.6.2";
+    src = fetchurl {
+      url = "https://github.com/keplerproject/luafilesystem/archive/v1_6_2.tar.gz";
+      sha256 = "1n8qdwa20ypbrny99vhkmx8q04zd2jjycdb5196xdhgvqzk10abz";
+    };  
+    meta = {
+      homepage = "https://github.com/keplerproject/luafilesystem";
+      hydraPlatforms = stdenv.lib.platforms.linux;
+      maintainers = with maintainers; [ flosse ];
+    };
+  };
+
+  sockets = buildLuaPackage rec {
+    name = "sockets-${version}";
+    version = "2.0.2";
+    src = fetchurl {
+        url = "http://files.luaforge.net/releases/luasocket/luasocket/luasocket-${version}/luasocket-${version}.tar.gz";
+        sha256 = "19ichkbc4rxv00ggz8gyf29jibvc2wq9pqjik0ll326rrxswgnag";
+    };
+    disabled = lua.luaversion != "5.1";
+    patchPhase = ''
+        sed -e "s,^INSTALL_TOP_SHARE.*,INSTALL_TOP_SHARE=$out/share/lua/${lua.luaversion}," \
+            -e "s,^INSTALL_TOP_LIB.*,INSTALL_TOP_LIB=$out/lib/lua/${lua.luaversion}," \
+            -i config
+    '';
+    meta = {
+      homepage = "http://w3.impa.br/~diego/software/luasocket/";
+      hydraPlatforms = stdenv.lib.platforms.linux;
+      maintainers = with maintainers; [ mornfall ];
+    };
+  };
+
+}; in self