I have this overlay:
(self: super:
{
emacsWithConfig = super.emacsWithPackages (epkgs:
(with epkgs.melpaPackages; [
pdf-tools
])
);
}
)
which creates a binary:
/nix/store/q41mwlrdzivg797xsmy7mpv1dqwdznbz-emacs-pdf-tools-20230611.239/share/emacs/site-lisp/elpa/pdf-tools-20230611.239/epdfinfo
/nix/store/8i03vd660s6ngjb2qi8f7jxzaql3pv9g-emacs-packages-deps/share/emacs/site-lisp/elpa/pdf-tools-20230611.239/epdfinfo
Can I put this binary in my path?
Yes, by putting pkgs.emacsWithConfig
in your systemPackages
.
I already have that,
environment.systemPackages = with pkgs; [
emacsWithConfig
, but it’s not in my PATH
Oh, I see, these binaries don’t live in bin
. Does /run/current-system/sw/share/emacs/site-lisp/elpa/pdf-tools-20230611.239
(wow) exist? You could just add that (the part after sw/
) to your path (environment.profileRelativeSessionVariables
).
No, this returns nothing
sudo find /run/current-system -iname "*pdf*"
Hm. The generated emacs derivation must not include links to its dependencies, then. Can you add emacsWithConfig.deps
to your systemPackages
too?
I wrote wrong command before. I do find epdfinfo in there
$ sudo find -L /run/current-system/sw/share/ -iname "*epdfinfo*"
/run/current-system/sw/share/emacs/site-lisp/elpa/pdf-tools-20230611.239/epdfinfo
, but how does this help me? I don’t want to add a static path to my PATH, cause that would need to be updated manually quite frequently, not?
<shrug> That’s where the file is. You could link it somewhere else; maybe you’d like to override pdf-tools
to include a postInstall
that links every binary found in $out
into bin
.
It might be an XY problem, in that I don’t really need it in my PATH. It’s only the variable inside Emacs that needs to be set to whatever the absolute path is.
(setq pdf-info-epdfinfo-program "/nix/store/q41mwlrdzivg797xsmy7mpv1dqwdznbz-emacs-pdf-tools-20230611.239/share/emacs/site-lisp/elpa/pdf-tools-20230611.239/epdfinfo")
This is what I have now, but I need to constantly update the path, cause nixos-rebuild changes the path. I also use the same Emacs config on multiple platforms, where every platform has its own path.
Adding the path to profileRelativeSessionVariables
and adding the path to an Emacs config file are basically the same. Either way you need to specify the path in the package.
I don’t really understand your objection to something like
let
inherit (pkgs.emacsPackages.melpaPackages) pdf-tools;
in
"${pdf-tools}/share/emacs/site-lisp/elpa/pdf-tools-${pdf-tools.version}/epdfinfo"
It’s an ugly expression for sure but it’ll probably be stable for a fair amount of time. It sure is a lot better than manually specifying a store path that changes on every upgrade.
I don’t object to it. It’s probably more a thing I don’t understand. That solution looks perfect, but where do I add this? I got some errors on line 2, so I’m not sure if I add it correctly;)
That’ll be because I missed a semicolon.
Either drop the initial ${pdf-tools}/
and the final /epdfinfo
and stick it in profileRelativeSessionVariables
, or keep it as-is and use it in your Home Manager programs.emacs.extraConfig
.