Skip to content

Commit

Permalink
lua: fix on darwin by using makeBinaryWrapper
Browse files Browse the repository at this point in the history
Darwin execve has issues with shebang lines that point to other scripts
with shebang lines. A new makeBinaryWrapper hook was added to workaround
the issue on darwin. See NixOS#171473 and NixOS#23018 for more information. This
uses that binary wrapper to fix packages like sile.

I'm not sure this can be considered complete but it appears to work for
sile at least.
  • Loading branch information
zaphar committed May 16, 2022
1 parent b428db1 commit b26024b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pkgs/development/interpreters/lua-5/default.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# similar to interpreters/python/default.nix
{ stdenv, lib, callPackage, fetchurl, fetchpatch }:
{ stdenv, lib, callPackage, fetchurl, fetchpatch, makeBinaryWrapper }:

rec {
lua5_4 = callPackage ./interpreter.nix {
sourceVersion = { major = "5"; minor = "4"; patch = "3"; };
hash = "1yxvjvnbg4nyrdv10bq42gz6dr66pyan28lgzfygqfwy2rv24qgq";
makeWrapper = makeBinaryWrapper;

patches = lib.optional stdenv.isDarwin ./5.4.darwin.patch;
};
Expand All @@ -16,6 +17,7 @@ rec {
lua5_3 = callPackage ./interpreter.nix {
sourceVersion = { major = "5"; minor = "3"; patch = "6"; };
hash = "0q3d8qhd7p0b7a4mh9g7fxqksqfs6mr1nav74vq26qvkp2dxcpzw";
makeWrapper = makeBinaryWrapper;

patches =
lib.optionals stdenv.isDarwin [ ./5.2.darwin.patch ];
Expand All @@ -29,6 +31,7 @@ rec {
lua5_2 = callPackage ./interpreter.nix {
sourceVersion = { major = "5"; minor = "2"; patch = "4"; };
hash = "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr";
makeWrapper = makeBinaryWrapper;
patches = lib.optional stdenv.isDarwin ./5.2.darwin.patch;
};

Expand All @@ -40,6 +43,7 @@ rec {
lua5_1 = callPackage ./interpreter.nix {
sourceVersion = { major = "5"; minor = "1"; patch = "5"; };
hash = "2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333";
makeWrapper = makeBinaryWrapper;
patches = (lib.optional stdenv.isDarwin ./5.1.darwin.patch)
++ [ ./CVE-2014-5461.patch ];
};
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/interpreters/lua-5/interpreter.nix
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ self = stdenv.mkDerivation rec {
passthru = rec {
buildEnv = callPackage ./wrapper.nix {
lua = self;
inherit makeWrapper;
inherit (luaPackages) requiredLuaModules;
};
withPackages = import ./with-packages.nix { inherit buildEnv luaPackages;};
Expand Down
1 change: 0 additions & 1 deletion pkgs/tools/typesetting/sile/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ stdenv.mkDerivation rec {
homepage = "https://sile-typesetter.org";
changelog = "https://github.com/sile-typesetter/sile/raw/v${version}/CHANGELOG.md";
platforms = platforms.unix;
broken = stdenv.isDarwin; # https://github.com/NixOS/nixpkgs/issues/23018
maintainers = with maintainers; [ doronbehar alerque ];
license = licenses.mit;
};
Expand Down

0 comments on commit b26024b

Please sign in to comment.