reddit / emacs

An emacs/use-package specific question that is related to the nix package manager:

zeta_00 · 2022-02-20 06:49
;;------------------------------------------------- (use-package math-preview ;; :custom ;; (math-preview-command "/path/to/math-preview") :defer t) ;;------------------------------------------------- Is there a way to do a generic path? I'm using nix to install my emacs packages, so, I need a generic way to do this that will work whenever the path changes, nix uses new hashes for unique identities for packages. Thanks in advance for the help.
franburstall · 2022-02-20 09:52
So long as `math-preview` is somewhere on your PATH, either (math-preview-command "math-preview") or (math-preview-command (executable-find "math-preview")) should do the job.
zeta_00 · 2022-02-20 09:57
Thanks, I'll try that out.
bbenne10 · 2022-02-20 12:19
I use nix to handle my config, which allows using all of the usual nix tricks. That might work for you too, but a config update requires a new darwin/nixos generation. This is fine with me, as I use flakes for managing systems so the new generation is quick to produce.
ftrx · 2022-02-20 15:04
You also have two other options, one only for NixOS (AFAIK) and the other might be useful for different usage (i.e. for Maxima elisp backend, witch is not an executable but Emacs need to know the right path to (require) it properly): - NixOS symlink all relevant executable under `/run/current-system/sw/bin/` - nix can be used to get relevant "output paths" of any derivation see below for the aforementioned maxima example (push (concat (shell-command-to-string "nix eval nixpkgs.maxima.outPath | sed 's/\"//g' | tr -d '\n'") "/share/emacs/site-lisp") load-path) (autoload 'imaxima "imaxima" "Maxima frontend" t) (autoload 'imath "imath" "Interactive Math mode" t) (autoload 'maxima-mode "maxima" "Maxima mode" t) (autoload 'maxima "maxima" "Maxima interaction" t) (autoload 'imath-mode "imath" "Imath mode for math formula input" t) (setq imaxima-use-maxima-mode-flag t) edit: formatting