diff options
author | Hraban Luyat <hraban@0brg.net> | 2023-09-04 01:20:27 -0400 |
---|---|---|
committer | Anderson Torres <torres.anderson.85@protonmail.com> | 2023-09-24 19:50:52 -0300 |
commit | 1b26fc011a0f136f05e4a2f3e6e5b5c6e0c5214e (patch) | |
tree | a1c92786d174ee5612b5463f53964ff1cae02375 /pkgs/build-support/emacs | |
parent | 949ea0426d78c433bbc8e630f254a45dc5f25e08 (diff) |
emacs: allow using as shebang on darwin
Diffstat (limited to 'pkgs/build-support/emacs')
-rw-r--r-- | pkgs/build-support/emacs/wrapper.nix | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pkgs/build-support/emacs/wrapper.nix b/pkgs/build-support/emacs/wrapper.nix index baeeb5599bf39..6c1383c53304c 100644 --- a/pkgs/build-support/emacs/wrapper.nix +++ b/pkgs/build-support/emacs/wrapper.nix @@ -32,7 +32,7 @@ in customEmacsPackages.withPackages (epkgs: [ epkgs.evil epkgs.magit ]) */ -{ lib, lndir, runCommand, gcc }: +{ lib, lndir, makeBinaryWrapper, runCommand, gcc }: self: let inherit (self) emacs; @@ -50,7 +50,7 @@ runCommand (lib.appendToName "with-packages" emacs).name { inherit emacs explicitRequires; - nativeBuildInputs = [ emacs lndir ]; + nativeBuildInputs = [ emacs lndir makeBinaryWrapper ]; preferLocalBuild = true; allowSubstitutes = false; @@ -201,6 +201,11 @@ runCommand --subst-var-by wrapperSiteLispNative "$deps/share/emacs/native-lisp" \ --subst-var prog chmod +x $out/bin/$progname + # Create a “NOP” binary wrapper for the pure sake of it becoming a + # non-shebang, actual binary. See the makeBinaryWrapper docs for rationale + # (summary: it allows you to use emacs as a shebang itself on Darwin, + # e.g. #!$ {emacs}/bin/emacs --script) + wrapProgramBinary $out/bin/$progname done # Wrap MacOS app @@ -220,6 +225,7 @@ runCommand --subst-var-by wrapperSiteLispNative "$deps/share/emacs/native-lisp" \ --subst-var-by prog "$emacs/Applications/Emacs.app/Contents/MacOS/Emacs" chmod +x $out/Applications/Emacs.app/Contents/MacOS/Emacs + wrapProgramBinary $out/Applications/Emacs.app/Contents/MacOS/Emacs fi mkdir -p $out/share |