I use doom-emacs. One of its modules is a PDF module, which uses the package pdf-tools. Pdf-tools is really annoying on Nixos, since if needs some binary and wants to build it. But then of course it fails with:
/home/jon/.emacs.d/.local/straight/build-27.1/pdf-tools/build/server/autobuild -i /home/jon/.emacs.d/.local/straight/build-27.1/pdf-tools/
/nix/store/qdp56fi357fgxxnkjrwx1g67hrk775im-bash-4.4-p23/bin/sh: /home/jon/.emacs.d/.local/straight/build-27.1/pdf-tools/build/server/autobuild: Permission denied
I noticed that I can get pdf-tools already compiled and in emacs by using emacsWithPackages:
(emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [
pdf-tools
])))
And I added this to my config.el
(although I’m not sure what it does or why I need it):
;; Enables Nixos-installed packages to be loaded
(require 'package)
(setq package-enable-at-startup nil)
(package-initialize)
But it doesn’t seem to take, since Emacs still complains: “Need to (re)build the epdfinfo program, do it now? (y or n)”. Amazingly, if I choose “n,” it still tries to build it.
Emacs apparently sees pdf-tools, from what I can tell, since describe-package pdf-tools
gives this:
Package pdf-tools is external.
Status: External in ‘/nix/store/nr0xzc92spcic1kwymv7nd5jcjs54p2w-emacs-packages-deps/share/emacs/site-lisp/elpa/pdf-tools-20200512.1524/’ (unsigned).
Version: 20200512.1524
Summary: Support library for PDF documents.
Installing this package should install and build epdfinfo
, from poppler
, according to this section in Nixpkgs, no?
And indeed, I seem to have a file nr0xzc92spcic1kwymv7nd5jcjs54p2w-emacs-packages-deps/share/emacs/site-lisp/elpa/pdf-tools-20200512.1524/epdfinfo
.
So I just want to get it to where pdf-tools will work. Any ideas?