I’m trying to override Emacs to include additional packages into its PATH (for example pandoc or graphviz) in order have them available for Org-mode but to not pollute my system environment with them. What I tried is (adding makeWrapper
to nativeBuildInputs
is not needed because it is already in the derivation included in Nixpkgs):
myEmacsPackage = pkgs.emacsUnstable.overrideAttrs (finalAttrs: prevAttrs: {
postInstall = ''
wrapProgram $out/bin/emacs --prefix PATH : "${
lib.makeBinPath [ pkgs.pandoc ]
}"
'';
});
This fails with the strange error message from (bash):
patching script interpreter paths in /nix/store/0kpx40di7gh4p3hxwkia90b6l5sr0csr-emacs-unstable-28.2
/nix/store/0kpx40di7gh4p3hxwkia90b6l5sr0csr-emacs-unstable-28.2/libexec/emacs/28.2/x86_64-pc-linux-gnu/rcs2log: interpreter directive changed from "#! /bin/sh" to "/nix/store/pj1hnyxhcsw1krmhnbb9rjvqssbzliw8-bash-5.2-p15/bin/sh"
strip is /nix/store/iiq295j1z4q1sxmdbrl2j8ma3l5ns4wr-gcc-wrapper-11.3.0/bin/strip
stripping (with command strip and flags -S) in /nix/store/0kpx40di7gh4p3hxwkia90b6l5sr0csr-emacs-unstable-28.2/lib /nix/store/0kpx40di7gh4p3hxwkia90b6l5sr0csr-emacs-unstable-28.2/libexec /nix/store/0kpx40di7gh4p3hxwkia90b6l5sr0csr-emacs-unstable-28.2/bin
patchelf: not an ELF executable
/nix/store/chilfhdcsnmwjl7igrw26j1lrc0zar35-stdenv-linux/setup: line 129: pop_var_context: head of shell_variables not a function context
I’m not sure if that matters (I don’t think so), but I’m using the emacs-overlay.
The derivation in Nixpkgs of Emacs already contains a postInstall
phase. Does the addition of my postInstall
overwrite the existing one in the Emacs derivation?
What is proper way to achieve my goal of adding additional packages to Emacs PATH?
I already thought about using symlinkJoin
but I’m not sure what would be the most idiomatic way to do it.
Thanks