Commit 1b26fc01 authored by Hraban Luyat's avatar Hraban Luyat Committed by Anderson Torres
Browse files

emacs: allow using as shebang on darwin

parent 949ea042
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -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
+1 −2
Original line number Diff line number Diff line
@@ -47,8 +47,7 @@ let
    inherit lib pkgs;
  };

  emacsWithPackages = { pkgs, lib }: import ../build-support/emacs/wrapper.nix {
    inherit (pkgs) makeWrapper runCommand gcc;
  emacsWithPackages = { pkgs, lib }: pkgs.callPackage ../build-support/emacs/wrapper.nix {
    inherit (pkgs.xorg) lndir;
    inherit lib;
  };