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

luaPackages.luarocks: generate luarocks as well

authored by 7c6f434c and committed by GitHub 21cc0e05 c149b881

+68 -4
+1
maintainers/scripts/luarocks-packages.csv
··· 77 luaossl,,,,,5.1, 78 luaposix,,,,34.1.1-1,,vyp lblasc 79 luarepl,,,,,, 80 luarocks-build-rust-mlua,,,,,,mrcjkb 81 luarocks-build-treesitter-parser,,,,,,mrcjkb 82 luasec,,,,,,flosse
··· 77 luaossl,,,,,5.1, 78 luaposix,,,,34.1.1-1,,vyp lblasc 79 luarepl,,,,,, 80 + luarocks,,,,,,mrcjkb teto 81 luarocks-build-rust-mlua,,,,,,mrcjkb 82 luarocks-build-treesitter-parser,,,,,,mrcjkb 83 luasec,,,,,,flosse
+3 -3
pkgs/development/interpreters/lua-5/build-luarocks-package.nix
··· 2 { lib 3 , lua 4 , wrapLua 5 - , luarocks 6 , writeTextFile 7 8 # Whether the derivation provides a lua module or not. ··· 91 nativeBuildInputs = [ 92 lua # for lua.h 93 wrapLua 94 - luarocks 95 ]; 96 97 inherit doCheck extraConfig rockspecFilename knownRockspec externalDeps nativeCheckInputs; ··· 99 buildInputs = let 100 # example externalDeps': [ { name = "CRYPTO"; dep = pkgs.openssl; } ] 101 externalDeps' = lib.filter (dep: !lib.isDerivation dep) self.externalDeps; 102 - in [ lua.pkgs.luarocks ] 103 ++ buildInputs 104 ++ lib.optionals self.doCheck ([ luarocksCheckHook ] ++ self.nativeCheckInputs) 105 ++ (map (d: d.dep) externalDeps')
··· 2 { lib 3 , lua 4 , wrapLua 5 + , luarocks_bootstrap 6 , writeTextFile 7 8 # Whether the derivation provides a lua module or not. ··· 91 nativeBuildInputs = [ 92 lua # for lua.h 93 wrapLua 94 + luarocks_bootstrap 95 ]; 96 97 inherit doCheck extraConfig rockspecFilename knownRockspec externalDeps nativeCheckInputs; ··· 99 buildInputs = let 100 # example externalDeps': [ { name = "CRYPTO"; dep = pkgs.openssl; } ] 101 externalDeps' = lib.filter (dep: !lib.isDerivation dep) self.externalDeps; 102 + in [ luarocks_bootstrap ] 103 ++ buildInputs 104 ++ lib.optionals self.doCheck ([ luarocksCheckHook ] ++ self.nativeCheckInputs) 105 ++ (map (d: d.dep) externalDeps')
+24
pkgs/development/lua-modules/generated-packages.nix
··· 1913 }; 1914 }) {}; 1915 1916 luarocks-build-rust-mlua = callPackage({ buildLuarocksPackage, fetchFromGitHub, fetchurl }: 1917 buildLuarocksPackage { 1918 pname = "luarocks-build-rust-mlua";
··· 1913 }; 1914 }) {}; 1915 1916 + luarocks = callPackage({ buildLuarocksPackage, fetchFromGitHub, fetchurl }: 1917 + buildLuarocksPackage { 1918 + pname = "luarocks"; 1919 + version = "3.11.0-1"; 1920 + knownRockspec = (fetchurl { 1921 + url = "mirror://luarocks/luarocks-3.11.0-1.rockspec"; 1922 + sha256 = "0pi55445dskpw6nhrq52589h4v39fsf23c0kp8d4zg2qaf6y2n38"; 1923 + }).outPath; 1924 + src = fetchFromGitHub { 1925 + owner = "luarocks"; 1926 + repo = "luarocks"; 1927 + rev = "v3.11.0"; 1928 + hash = "sha256-mSwwBuLWoMT38iYaV/BTdDmmBz4heTRJzxBHC0Vrvc4="; 1929 + }; 1930 + 1931 + 1932 + meta = { 1933 + homepage = "http://www.luarocks.org"; 1934 + description = "A package manager for Lua modules."; 1935 + maintainers = with lib.maintainers; [ mrcjkb teto ]; 1936 + license.fullName = "MIT"; 1937 + }; 1938 + }) {}; 1939 + 1940 luarocks-build-rust-mlua = callPackage({ buildLuarocksPackage, fetchFromGitHub, fetchurl }: 1941 buildLuarocksPackage { 1942 pname = "luarocks-build-rust-mlua";
+30
pkgs/development/lua-modules/overrides.nix
··· 54 , vimPlugins 55 , vimUtils 56 , yajl 57 , zlib 58 , zziplib 59 }: ··· 405 externalDeps = [ 406 { name = "CRYPT"; dep = libxcrypt; } 407 ]; 408 }); 409 410 luasec = prev.luasec.overrideAttrs (oa: {
··· 54 , vimPlugins 55 , vimUtils 56 , yajl 57 + , zip 58 + , unzip 59 , zlib 60 , zziplib 61 }: ··· 407 externalDeps = [ 408 { name = "CRYPT"; dep = libxcrypt; } 409 ]; 410 + }); 411 + 412 + 413 + # As a nix user, use this derivation instead of "luarocks_bootstrap" 414 + luarocks = prev.luarocks.overrideAttrs (oa: { 415 + 416 + nativeBuildInputs = oa.nativeBuildInputs ++ [ installShellFiles lua unzip ]; 417 + # cmake is just to compile packages with "cmake" buildType, not luarocks itself 418 + dontUseCmakeConfigure = true; 419 + 420 + propagatedBuildInputs = [ zip unzip cmake ]; 421 + 422 + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' 423 + installShellCompletion --cmd luarocks \ 424 + --bash <($out/bin/luarocks completion bash) \ 425 + --fish <($out/bin/luarocks completion fish) \ 426 + --zsh <($out/bin/luarocks completion zsh) 427 + 428 + installShellCompletion --cmd luarocks-admin \ 429 + --bash <($out/bin/luarocks-admin completion bash) \ 430 + --fish <($out/bin/luarocks-admin completion fish) \ 431 + --zsh <($out/bin/luarocks-admin completion zsh) 432 + ''; 433 + 434 + meta = oa.meta // { 435 + mainProgram = "luarocks"; 436 + }; 437 + 438 }); 439 440 luasec = prev.luasec.overrideAttrs (oa: {
+9
pkgs/development/tools/misc/luarocks/default.nix
··· 1 { lib 2 , stdenv 3 , fetchFromGitHub
··· 1 + /* 2 + This is a minimal/manual luarocks derivation used by `buildLuarocksPackage` to install lua packages. 3 + 4 + As a nix user, you should use the generated lua.pkgs.luarocks that contains a luarocks manifest 5 + which makes it recognizable to luarocks. 6 + Generating the manifest for luarocks_bootstrap seemed too hackish, which is why we end up 7 + with two "luarocks" derivations. 8 + 9 + */ 10 { lib 11 , stdenv 12 , fetchFromGitHub
+1 -1
pkgs/top-level/lua-packages.nix
··· 54 inherit (pkgs.buildPackages) makeSetupHook makeWrapper; 55 }; 56 57 - luarocks = toLuaModule (callPackage ../development/tools/misc/luarocks/default.nix { }); 58 59 # a fork of luarocks used to generate nix lua derivations from rockspecs 60 luarocks-nix = toLuaModule (callPackage ../development/tools/misc/luarocks/luarocks-nix.nix { });
··· 54 inherit (pkgs.buildPackages) makeSetupHook makeWrapper; 55 }; 56 57 + luarocks_bootstrap = toLuaModule (callPackage ../development/tools/misc/luarocks/default.nix { }); 58 59 # a fork of luarocks used to generate nix lua derivations from rockspecs 60 luarocks-nix = toLuaModule (callPackage ../development/tools/misc/luarocks/luarocks-nix.nix { });