Unverified Commit 21cc0e05 authored by 7c6f434c's avatar 7c6f434c Committed by GitHub
Browse files

Merge pull request #316221 from teto/matt/lua-add-luarocks

luaPackages.luarocks: generate luarocks as well
parents c149b881 2ea757a0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ lualogging,,,,,,
luaossl,,,,,5.1,
luaposix,,,,34.1.1-1,,vyp lblasc
luarepl,,,,,,
luarocks,,,,,,mrcjkb teto
luarocks-build-rust-mlua,,,,,,mrcjkb
luarocks-build-treesitter-parser,,,,,,mrcjkb
luasec,,,,,,flosse
+3 −3
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
{ lib
, lua
, wrapLua
, luarocks
, luarocks_bootstrap
, writeTextFile

# Whether the derivation provides a lua module or not.
@@ -91,7 +91,7 @@ let
  nativeBuildInputs = [
    lua  # for lua.h
    wrapLua
    luarocks
    luarocks_bootstrap
  ];

  inherit doCheck extraConfig rockspecFilename knownRockspec externalDeps nativeCheckInputs;
@@ -99,7 +99,7 @@ let
  buildInputs = let
    # example externalDeps': [ { name = "CRYPTO"; dep = pkgs.openssl; } ]
    externalDeps' = lib.filter (dep: !lib.isDerivation dep) self.externalDeps;
    in [ lua.pkgs.luarocks ]
    in [ luarocks_bootstrap ]
      ++ buildInputs
      ++ lib.optionals self.doCheck ([ luarocksCheckHook ] ++ self.nativeCheckInputs)
      ++ (map (d: d.dep) externalDeps')
+24 −0
Original line number Diff line number Diff line
@@ -1913,6 +1913,30 @@ buildLuarocksPackage {
  };
}) {};

luarocks = callPackage({ buildLuarocksPackage, fetchFromGitHub, fetchurl }:
buildLuarocksPackage {
  pname = "luarocks";
  version = "3.11.0-1";
  knownRockspec = (fetchurl {
    url    = "mirror://luarocks/luarocks-3.11.0-1.rockspec";
    sha256 = "0pi55445dskpw6nhrq52589h4v39fsf23c0kp8d4zg2qaf6y2n38";
  }).outPath;
  src = fetchFromGitHub {
    owner = "luarocks";
    repo = "luarocks";
    rev = "v3.11.0";
    hash = "sha256-mSwwBuLWoMT38iYaV/BTdDmmBz4heTRJzxBHC0Vrvc4=";
  };


  meta = {
    homepage = "http://www.luarocks.org";
    description = "A package manager for Lua modules.";
    maintainers = with lib.maintainers; [ mrcjkb teto ];
    license.fullName = "MIT";
  };
}) {};

luarocks-build-rust-mlua = callPackage({ buildLuarocksPackage, fetchFromGitHub, fetchurl }:
buildLuarocksPackage {
  pname = "luarocks-build-rust-mlua";
+30 −0
Original line number Diff line number Diff line
@@ -54,6 +54,8 @@
, vimPlugins
, vimUtils
, yajl
, zip
, unzip
, zlib
, zziplib
}:
@@ -407,6 +409,34 @@ in
    ];
  });


  # As a nix user, use this derivation instead of "luarocks_bootstrap"
  luarocks = prev.luarocks.overrideAttrs (oa: {

    nativeBuildInputs = oa.nativeBuildInputs ++ [ installShellFiles lua unzip ];
    # cmake is just to compile packages with "cmake" buildType, not luarocks itself
    dontUseCmakeConfigure = true;

    propagatedBuildInputs = [ zip unzip cmake ];

    postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
      installShellCompletion --cmd luarocks \
        --bash <($out/bin/luarocks completion bash) \
        --fish <($out/bin/luarocks completion fish) \
        --zsh <($out/bin/luarocks completion zsh)

      installShellCompletion --cmd luarocks-admin \
        --bash <($out/bin/luarocks-admin completion bash) \
        --fish <($out/bin/luarocks-admin completion fish) \
        --zsh <($out/bin/luarocks-admin completion zsh)
    '';

    meta = oa.meta // {
      mainProgram = "luarocks";
    };

  });

  luasec = prev.luasec.overrideAttrs (oa: {
    externalDeps = [
      { name = "OPENSSL"; dep = openssl; }
+9 −0
Original line number Diff line number Diff line
/*
This is a minimal/manual luarocks derivation used by `buildLuarocksPackage` to install lua packages.

As a nix user, you should use the generated lua.pkgs.luarocks that contains a luarocks manifest
which makes it recognizable to luarocks.
Generating the manifest for luarocks_bootstrap seemed too hackish, which is why we end up
with two "luarocks" derivations.

*/
{ lib
, stdenv
, fetchFromGitHub
Loading