From 20b48c37275fe931a46233a7f3f2cb6aa8cf68e2 Mon Sep 17 00:00:00 2001 From: Luka Blaskovic Date: Wed, 25 Aug 2021 10:33:48 +0000 Subject: [PATCH 1/8] Revert "neovim: use luajit_openresty on aarch64-darwin" This reverts commit fb5156c0e8508d82ac4e750c134cb8f4fc92c9f8. --- pkgs/top-level/all-packages.nix | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 982122bf59ed..b2b6e710314f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -28017,11 +28017,31 @@ with pkgs; wrapNeovimUnstable = callPackage ../applications/editors/neovim/wrapper.nix { }; wrapNeovim = neovim-unwrapped: lib.makeOverridable (neovimUtils.legacyWrapper neovim-unwrapped); neovim-unwrapped = callPackage ../applications/editors/neovim { - # See: - # - https://github.com/NixOS/nixpkgs/issues/129099 - # - https://github.com/NixOS/nixpkgs/issues/128959 + # neovim doesn't build with luajit on aarch64-darwin : + # ./luarocks init + # PANIC: unprotected error in call to Lua API (module 'luarocks.core.hardcoded' not found: + # no field package.preload['luarocks.core.hardcoded'] + # no file '/private/tmp/nix-build-luarocks-3.2.1.drv-0/source/src/luarocks/core/hardcoded.lua' + # no file './luarocks/core/hardcoded.lua' + # no file '/nix/store/3s6c509q9vvq3db87rfi7qa38wzxwz8w-luajit-2.1.0-2021-05-29/share/luajit-2.1.0-beta3/luarocks/core/hardcoded.lua' + # no file '/usr/local/share/lua/5.1/luarocks/core/hardcoded.lua' + # no file '/usr/local/share/lua/5.1/luarocks/core/hardcoded/init.lua' + # no file '/nix/store/3s6c509q9vvq3db87rfi7qa38wzxwz8w-luajit-2.1.0-2021-05-29/share/lua/5.1/luarocks/core/hardcoded.lua' + # no file '/nix/store/3s6c509q9vvq3db87rfi7qa38wzxwz8w-luajit-2.1.0-2021-05-29/share/lua/5.1/luarocks/core/hardcoded/init.lua' + # no file './luarocks/core/hardcoded.so' + # no file '/usr/local/lib/lua/5.1/luarocks/core/hardcoded.so' + # no file '/nix/store/3s6c509q9vvq3db87rfi7qa38wzxwz8w-luajit-2.1.0-2021-05-29/lib/lua/5.1/luarocks/core/hardcoded.so' + # no file '/usr/local/lib/lua/5.1/loadall.so' + # no file './luarocks.so' + # no file '/usr/local/lib/lua/5.1/luarocks.so' + # no file '/nix/store/3s6c509q9vvq3db87rfi7qa38wzxwz8w-luajit-2.1.0-2021-05-29/lib/lua/5.1/luarocks.so' + # no file '/usr/local/lib/lua/5.1/loadall.so') + # make: *** [GNUmakefile:57: luarocks] Error 1 + # + # See https://github.com/NixOS/nixpkgs/issues/129099 + # Possibly related: https://github.com/neovim/neovim/issues/7879 lua = - if (stdenv.isDarwin && stdenv.isAarch64) then luajit_openresty else + if (stdenv.isDarwin && stdenv.isAarch64) then lua5_1 else luajit; }; From d5fe0d2b6e2117b08d5c1adac86a2e42ca93c5c5 Mon Sep 17 00:00:00 2001 From: Luka Blaskovic Date: Wed, 25 Aug 2021 10:33:56 +0000 Subject: [PATCH 2/8] Revert "luajit_openresty: init" This reverts commit 0b467dfa956485833713374d015bc2a8dcbd9133. --- pkgs/development/interpreters/lua-5/default.nix | 5 ----- pkgs/development/interpreters/luajit/2.0.nix | 2 -- pkgs/development/interpreters/luajit/2.1.nix | 2 -- pkgs/development/interpreters/luajit/default.nix | 6 +++--- pkgs/development/interpreters/luajit/openresty.nix | 10 ---------- pkgs/top-level/all-packages.nix | 2 +- 6 files changed, 4 insertions(+), 23 deletions(-) delete mode 100644 pkgs/development/interpreters/luajit/openresty.nix diff --git a/pkgs/development/interpreters/lua-5/default.nix b/pkgs/development/interpreters/lua-5/default.nix index f2b2961c4c77..3e36f77dab43 100644 --- a/pkgs/development/interpreters/lua-5/default.nix +++ b/pkgs/development/interpreters/lua-5/default.nix @@ -54,9 +54,4 @@ rec { inherit callPackage; }; - luajit_openresty = import ../luajit/openresty.nix { - self = luajit_openresty; - inherit callPackage; - }; - } diff --git a/pkgs/development/interpreters/luajit/2.0.nix b/pkgs/development/interpreters/luajit/2.0.nix index ceb796f0433e..153b11aaa5fc 100644 --- a/pkgs/development/interpreters/luajit/2.0.nix +++ b/pkgs/development/interpreters/luajit/2.0.nix @@ -1,8 +1,6 @@ { self, callPackage, lib }: callPackage ./default.nix { inherit self; - owner = "LuaJIT"; - repo = "LuaJIT"; version = "2.0.5-2021-06-08"; rev = "98f95f69180d48ce49289d6428b46a9ccdd67a46"; isStable = true; diff --git a/pkgs/development/interpreters/luajit/2.1.nix b/pkgs/development/interpreters/luajit/2.1.nix index 87976a45dfe1..d11514c07c62 100644 --- a/pkgs/development/interpreters/luajit/2.1.nix +++ b/pkgs/development/interpreters/luajit/2.1.nix @@ -1,8 +1,6 @@ { self, callPackage }: callPackage ./default.nix { inherit self; - owner = "LuaJIT"; - repo = "LuaJIT"; version = "2.1.0-2021-06-25"; rev = "e957737650e060d5bf1c2909b741cc3dffe073ac"; isStable = false; diff --git a/pkgs/development/interpreters/luajit/default.nix b/pkgs/development/interpreters/luajit/default.nix index 728161598282..860642b0fd2f 100644 --- a/pkgs/development/interpreters/luajit/default.nix +++ b/pkgs/development/interpreters/luajit/default.nix @@ -1,8 +1,6 @@ { lib, stdenv, fetchFromGitHub, buildPackages , name ? "luajit-${version}" , isStable -, owner -, repo , sha256 , rev , version @@ -43,7 +41,9 @@ in stdenv.mkDerivation rec { inherit name version; src = fetchFromGitHub { - inherit owner repo sha256 rev; + owner = "LuaJIT"; + repo = "LuaJIT"; + inherit sha256 rev; }; luaversion = "5.1"; diff --git a/pkgs/development/interpreters/luajit/openresty.nix b/pkgs/development/interpreters/luajit/openresty.nix deleted file mode 100644 index 78e06f46f1d0..000000000000 --- a/pkgs/development/interpreters/luajit/openresty.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ self, callPackage }: -callPackage ./default.nix rec { - inherit self; - owner = "openresty"; - repo = "luajit2"; - version = "2.1-20210510"; - rev = "v${version}"; - isStable = true; - sha256 = "1h21w5axwka2j9jb86yc69qrprcavccyr2qihiw4b76r1zxzalvd"; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b2b6e710314f..40d4d549004a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12691,7 +12691,7 @@ with pkgs; ### LUA interpreters luaInterpreters = callPackage ./../development/interpreters/lua-5 {}; - inherit (luaInterpreters) lua5_1 lua5_2 lua5_2_compat lua5_3 lua5_3_compat lua5_4 lua5_4_compat luajit_openresty luajit_2_1 luajit_2_0; + inherit (luaInterpreters) lua5_1 lua5_2 lua5_2_compat lua5_3 lua5_3_compat lua5_4 lua5_4_compat luajit_2_1 luajit_2_0; lua5 = lua5_2_compat; lua = lua5; From a15ee4845bec7dd5dfe74971d23b788cb2d49885 Mon Sep 17 00:00:00 2001 From: Luka Blaskovic Date: Wed, 25 Aug 2021 10:35:49 +0000 Subject: [PATCH 3/8] luajit: format with nixpkgs-fmt --- .../interpreters/luajit/default.nix | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/pkgs/development/interpreters/luajit/default.nix b/pkgs/development/interpreters/luajit/default.nix index 860642b0fd2f..2a94f9f69e7c 100644 --- a/pkgs/development/interpreters/luajit/default.nix +++ b/pkgs/development/interpreters/luajit/default.nix @@ -1,13 +1,16 @@ -{ lib, stdenv, fetchFromGitHub, buildPackages +{ lib +, stdenv +, fetchFromGitHub +, buildPackages , name ? "luajit-${version}" , isStable , sha256 , rev , version -, extraMeta ? {} +, extraMeta ? { } , callPackage , self -, packageOverrides ? (self: super: {}) +, packageOverrides ? (self: super: { }) , enableFFI ? true , enableJIT ? true , enableJITDebugModule ? enableJIT @@ -24,25 +27,25 @@ assert enableJITDebugModule -> enableJIT; assert enableGDBJITSupport -> enableJIT; assert enableValgrindSupport -> valgrind != null; let - luaPackages = callPackage ../../lua-modules {lua=self; overrides=packageOverrides;}; + luaPackages = callPackage ../../lua-modules { lua = self; overrides = packageOverrides; }; XCFLAGS = with lib; - optional (!enableFFI) "-DLUAJIT_DISABLE_FFI" - ++ optional (!enableJIT) "-DLUAJIT_DISABLE_JIT" - ++ optional enable52Compat "-DLUAJIT_ENABLE_LUA52COMPAT" - ++ optional (!enableGC64) "-DLUAJIT_DISABLE_GC64" - ++ optional useSystemMalloc "-DLUAJIT_USE_SYSMALLOC" - ++ optional enableValgrindSupport "-DLUAJIT_USE_VALGRIND" - ++ optional enableGDBJITSupport "-DLUAJIT_USE_GDBJIT" - ++ optional enableAPICheck "-DLUAJIT_USE_APICHECK" - ++ optional enableVMAssertions "-DLUAJIT_USE_ASSERT" + optional (!enableFFI) "-DLUAJIT_DISABLE_FFI" + ++ optional (!enableJIT) "-DLUAJIT_DISABLE_JIT" + ++ optional enable52Compat "-DLUAJIT_ENABLE_LUA52COMPAT" + ++ optional (!enableGC64) "-DLUAJIT_DISABLE_GC64" + ++ optional useSystemMalloc "-DLUAJIT_USE_SYSMALLOC" + ++ optional enableValgrindSupport "-DLUAJIT_USE_VALGRIND" + ++ optional enableGDBJITSupport "-DLUAJIT_USE_GDBJIT" + ++ optional enableAPICheck "-DLUAJIT_USE_APICHECK" + ++ optional enableVMAssertions "-DLUAJIT_USE_ASSERT" ; in stdenv.mkDerivation rec { inherit name version; src = fetchFromGitHub { - owner = "LuaJIT"; - repo = "LuaJIT"; + owner = "LuaJIT"; + repo = "LuaJIT"; inherit sha256 rev; }; @@ -82,8 +85,10 @@ stdenv.mkDerivation rec { ''; LuaPathSearchPaths = [ - "lib/lua/${luaversion}/?.lua" "share/lua/${luaversion}/?.lua" - "share/lua/${luaversion}/?/init.lua" "lib/lua/${luaversion}/?/init.lua" + "lib/lua/${luaversion}/?.lua" + "share/lua/${luaversion}/?.lua" + "share/lua/${luaversion}/?/init.lua" + "lib/lua/${luaversion}/?/init.lua" "share/${name}/?.lua" ]; LuaCPathSearchPaths = [ "lib/lua/${luaversion}/?.so" "share/lua/${luaversion}/?.so" ]; @@ -94,16 +99,16 @@ stdenv.mkDerivation rec { lua = self; inherit (luaPackages) requiredLuaModules; }; - withPackages = import ../lua-5/with-packages.nix { inherit buildEnv luaPackages;}; + withPackages = import ../lua-5/with-packages.nix { inherit buildEnv luaPackages; }; pkgs = luaPackages; interpreter = "${self}/bin/lua"; }; meta = with lib; { description = "High-performance JIT compiler for Lua 5.1"; - homepage = "http://luajit.org"; - license = licenses.mit; - platforms = platforms.linux ++ platforms.darwin; + homepage = "http://luajit.org"; + license = licenses.mit; + platforms = platforms.linux ++ platforms.darwin; maintainers = with maintainers; [ thoughtpolice smironov vcunat andir lblasc ]; } // extraMeta; } From 9634784777d48ce6352c0a7cd7ebde5abbd02ef3 Mon Sep 17 00:00:00 2001 From: Luka Blaskovic Date: Wed, 25 Aug 2021 11:02:11 +0000 Subject: [PATCH 4/8] luajit: disable unwind external on aarch64-darwin see: https://github.com/LuaJIT/LuaJIT/issues/698 --- .../aarch64-darwin-disable-unwind-external.patch | 14 ++++++++++++++ pkgs/development/interpreters/luajit/default.nix | 4 ++++ 2 files changed, 18 insertions(+) create mode 100644 pkgs/development/interpreters/luajit/aarch64-darwin-disable-unwind-external.patch diff --git a/pkgs/development/interpreters/luajit/aarch64-darwin-disable-unwind-external.patch b/pkgs/development/interpreters/luajit/aarch64-darwin-disable-unwind-external.patch new file mode 100644 index 000000000000..dcfb1e9d4e7f --- /dev/null +++ b/pkgs/development/interpreters/luajit/aarch64-darwin-disable-unwind-external.patch @@ -0,0 +1,14 @@ +diff --git a/src/Makefile b/src/Makefile +index 2538503f..7e6380da 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -320,7 +320,9 @@ ifeq (Darwin,$(TARGET_SYS)) + $(error missing: export MACOSX_DEPLOYMENT_TARGET=XX.YY) + endif + TARGET_STRIP+= -x ++ ifneq (arm64,$(shell uname -m)) + TARGET_XCFLAGS+= -DLUAJIT_UNWIND_EXTERNAL ++ endif + TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC + TARGET_DYNXLDOPTS= + TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER) diff --git a/pkgs/development/interpreters/luajit/default.nix b/pkgs/development/interpreters/luajit/default.nix index 2a94f9f69e7c..6a163c4b562f 100644 --- a/pkgs/development/interpreters/luajit/default.nix +++ b/pkgs/development/interpreters/luajit/default.nix @@ -51,6 +51,10 @@ stdenv.mkDerivation rec { luaversion = "5.1"; + # Fix for pcall on aarch64-darwin. + # Upstream issue: https://github.com/LuaJIT/LuaJIT/issues/698 + patches = lib.optionals (stdenv.hostPlatform.system == "aarch64-darwin") [ ./aarch64-darwin-disable-unwind-external.patch ]; + postPatch = '' substituteInPlace Makefile --replace ldconfig : if test -n "''${dontStrip-}"; then From fff205f4a31f2960c4daf8b5810200473b20d53e Mon Sep 17 00:00:00 2001 From: Luka Blaskovic Date: Wed, 25 Aug 2021 11:04:24 +0000 Subject: [PATCH 5/8] neovim: use luajit on aarch64-darwin --- pkgs/top-level/all-packages.nix | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 40d4d549004a..02a8ab333909 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -28017,32 +28017,7 @@ with pkgs; wrapNeovimUnstable = callPackage ../applications/editors/neovim/wrapper.nix { }; wrapNeovim = neovim-unwrapped: lib.makeOverridable (neovimUtils.legacyWrapper neovim-unwrapped); neovim-unwrapped = callPackage ../applications/editors/neovim { - # neovim doesn't build with luajit on aarch64-darwin : - # ./luarocks init - # PANIC: unprotected error in call to Lua API (module 'luarocks.core.hardcoded' not found: - # no field package.preload['luarocks.core.hardcoded'] - # no file '/private/tmp/nix-build-luarocks-3.2.1.drv-0/source/src/luarocks/core/hardcoded.lua' - # no file './luarocks/core/hardcoded.lua' - # no file '/nix/store/3s6c509q9vvq3db87rfi7qa38wzxwz8w-luajit-2.1.0-2021-05-29/share/luajit-2.1.0-beta3/luarocks/core/hardcoded.lua' - # no file '/usr/local/share/lua/5.1/luarocks/core/hardcoded.lua' - # no file '/usr/local/share/lua/5.1/luarocks/core/hardcoded/init.lua' - # no file '/nix/store/3s6c509q9vvq3db87rfi7qa38wzxwz8w-luajit-2.1.0-2021-05-29/share/lua/5.1/luarocks/core/hardcoded.lua' - # no file '/nix/store/3s6c509q9vvq3db87rfi7qa38wzxwz8w-luajit-2.1.0-2021-05-29/share/lua/5.1/luarocks/core/hardcoded/init.lua' - # no file './luarocks/core/hardcoded.so' - # no file '/usr/local/lib/lua/5.1/luarocks/core/hardcoded.so' - # no file '/nix/store/3s6c509q9vvq3db87rfi7qa38wzxwz8w-luajit-2.1.0-2021-05-29/lib/lua/5.1/luarocks/core/hardcoded.so' - # no file '/usr/local/lib/lua/5.1/loadall.so' - # no file './luarocks.so' - # no file '/usr/local/lib/lua/5.1/luarocks.so' - # no file '/nix/store/3s6c509q9vvq3db87rfi7qa38wzxwz8w-luajit-2.1.0-2021-05-29/lib/lua/5.1/luarocks.so' - # no file '/usr/local/lib/lua/5.1/loadall.so') - # make: *** [GNUmakefile:57: luarocks] Error 1 - # - # See https://github.com/NixOS/nixpkgs/issues/129099 - # Possibly related: https://github.com/neovim/neovim/issues/7879 - lua = - if (stdenv.isDarwin && stdenv.isAarch64) then lua5_1 else - luajit; + lua = luajit; }; neovimUtils = callPackage ../applications/editors/neovim/utils.nix { }; From d1d5367da79f327007c9069880f8ca23bf966de3 Mon Sep 17 00:00:00 2001 From: Luka Blaskovic Date: Wed, 25 Aug 2021 11:12:02 +0000 Subject: [PATCH 6/8] luajit_2_0: 2.1.0-2021-06-08 -> 2.1.0-2021-07-27 --- pkgs/development/interpreters/luajit/2.0.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/interpreters/luajit/2.0.nix b/pkgs/development/interpreters/luajit/2.0.nix index 153b11aaa5fc..d66f6af5e751 100644 --- a/pkgs/development/interpreters/luajit/2.0.nix +++ b/pkgs/development/interpreters/luajit/2.0.nix @@ -1,10 +1,10 @@ { self, callPackage, lib }: callPackage ./default.nix { inherit self; - version = "2.0.5-2021-06-08"; - rev = "98f95f69180d48ce49289d6428b46a9ccdd67a46"; + version = "2.0.5-2021-07-27"; + rev = "3a654999c6f00de4cb9e61232d23579442e544a0"; isStable = true; - sha256 = "1pdmhk5syp0nir80xcnkf6xy2w5rwslak8hgmjpgaxzlnrjcgs7p"; + sha256 = "0q187vn6bspn9i33hrvfy59mh83nd8jjmik5qkkkc3vls13jxr6z"; extraMeta = { # this isn't precise but it at least stops the useless Hydra build platforms = with lib; filter (p: p != "aarch64-linux") (platforms.linux ++ platforms.darwin); From 737e7314bc754c67fd896e69601189251bf06c09 Mon Sep 17 00:00:00 2001 From: Luka Blaskovic Date: Wed, 25 Aug 2021 11:12:32 +0000 Subject: [PATCH 7/8] luajit_2_1: 2.1.0-2021-06-25 -> 2.1.0-2021-08-12 --- pkgs/development/interpreters/luajit/2.1.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/interpreters/luajit/2.1.nix b/pkgs/development/interpreters/luajit/2.1.nix index d11514c07c62..6ac47a6c3359 100644 --- a/pkgs/development/interpreters/luajit/2.1.nix +++ b/pkgs/development/interpreters/luajit/2.1.nix @@ -1,8 +1,8 @@ { self, callPackage }: callPackage ./default.nix { inherit self; - version = "2.1.0-2021-06-25"; - rev = "e957737650e060d5bf1c2909b741cc3dffe073ac"; + version = "2.1.0-2021-08-12"; + rev = "8ff09d9f5ad5b037926be2a50dc32b681c5e7597"; isStable = false; - sha256 = "04i7n5xdd1nci4mv2p6bv71fq5b1nkswz12hcgirsxqbnkrlbbcj"; + sha256 = "18wp8sgmiwlslnvgs35cy35ji2igksyfm3f8hrx07hqmsq2d77vr"; } From 13a1ac5421780914bb35569a72956b8c5bf90c54 Mon Sep 17 00:00:00 2001 From: Luka Blaskovic Date: Thu, 26 Aug 2021 10:55:08 +0000 Subject: [PATCH 8/8] luajit_2_0: make it unsupported on all aarch64 platform variants --- pkgs/development/interpreters/luajit/2.0.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/luajit/2.0.nix b/pkgs/development/interpreters/luajit/2.0.nix index d66f6af5e751..efae91c17bc7 100644 --- a/pkgs/development/interpreters/luajit/2.0.nix +++ b/pkgs/development/interpreters/luajit/2.0.nix @@ -6,7 +6,7 @@ callPackage ./default.nix { isStable = true; sha256 = "0q187vn6bspn9i33hrvfy59mh83nd8jjmik5qkkkc3vls13jxr6z"; extraMeta = { # this isn't precise but it at least stops the useless Hydra build - platforms = with lib; filter (p: p != "aarch64-linux") + platforms = with lib; filter (p: !hasPrefix "aarch64-" p) (platforms.linux ++ platforms.darwin); }; }