From c3ddd95cf24639a6115c7756d78d9946e609e554 Mon Sep 17 00:00:00 2001 From: figsoda Date: Tue, 11 Oct 2022 10:39:00 -0400 Subject: [PATCH] luarocks{,-nix}: add necessary programs to PATH --- .../tools/misc/luarocks/default.nix | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/pkgs/development/tools/misc/luarocks/default.nix b/pkgs/development/tools/misc/luarocks/default.nix index 01b0f39567eb..da61e1f8a41d 100644 --- a/pkgs/development/tools/misc/luarocks/default.nix +++ b/pkgs/development/tools/misc/luarocks/default.nix @@ -1,23 +1,30 @@ -{lib, stdenv, fetchFromGitHub, buildPackages +{ lib +, stdenv +, fetchFromGitHub , fetchpatch -, curl, makeWrapper, which, unzip +, curl +, makeWrapper +, which +, unzip , lua -# for 'luarocks pack' +, file +, nix-prefetch-git + # for 'luarocks pack' , zip , nix-update-script -# some packages need to be compiled with cmake + # some packages need to be compiled with cmake , cmake , installShellFiles }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (self: { pname = "luarocks"; version = "3.9.1"; src = fetchFromGitHub { owner = "luarocks"; repo = "luarocks"; - rev = "v${version}"; + rev = "v${self.version}"; sha256 = "sha256-G6HDap3pspeQtGDBq+ukN7kftDaT/CozMVdYM60F6HI="; }; @@ -67,12 +74,16 @@ stdenv.mkDerivation rec { --suffix LUA_PATH ";" "$(echo "$out"/share/lua/*/)?.lua" \ --suffix LUA_PATH ";" "$(echo "$out"/share/lua/*/)?/init.lua" \ --suffix LUA_CPATH ";" "$(echo "$out"/lib/lua/*/)?.so" \ - --suffix LUA_CPATH ";" "$(echo "$out"/share/lua/*/)?/init.lua" + --suffix LUA_CPATH ";" "$(echo "$out"/share/lua/*/)?/init.lua" \ + --suffix PATH : ${lib.makeBinPath ([ unzip ] ++ + lib.optionals (self.pname == "luarocks-nix") [ file nix-prefetch-git ])} } done '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' - installShellCompletion --cmd luarocks --bash <($out/bin/luarocks completion bash) - installShellCompletion --cmd luarocks --zsh <($out/bin/luarocks completion zsh) + installShellCompletion --cmd luarocks \ + --bash <($out/bin/luarocks completion bash) \ + --fish <($out/bin/luarocks completion fish) \ + --zsh <($out/bin/luarocks completion zsh) ''; propagatedBuildInputs = [ zip unzip cmake ]; @@ -94,15 +105,15 @@ stdenv.mkDerivation rec { passthru = { updateScript = nix-update-script { - attrPath = pname; + attrPath = self.pname; }; }; meta = with lib; { description = "A package manager for Lua"; - license = licenses.mit ; - maintainers = with maintainers; [raskin teto]; + license = licenses.mit; + maintainers = with maintainers; [ raskin teto ]; platforms = platforms.linux ++ platforms.darwin; downloadPage = "http://luarocks.org/releases/"; }; -} +})