Emacs: Can I install a package declaratively after trying it out procedurally?

It might be possible to install the Emacs package org-roam declaratively in one’s .nix config files. I’m currently asking whether and how on the nixpkgs issue tracker:
https://github.com/NixOS/nixpkgs/pull/80280

In the meantime I want to try out org-roam. The NixOS manual’s chapter on Emacs says that you can install Emacs packages interactively, like you would on other systems, from (for example) package-list-packages.

But I’m worried that if I do that, and later I learn how to install it declaratively in my emacs.nix file, I won’t be able to make the declarative changes without borking something in my system.

I believe you can mix and match nixpkgs declarative emacs packages and packages installed interactively with Emacs’ built-in package manager (or any other). I’m not sure of which has higher priority, so you might need to remove manually installed packages when adding them declaratively.

Now, it’s a good idea to use that power sparingly and only install packages that are missing in nixpkgs or melpa. The way I did that (rarely) in the past is cloning git repos and using use-package’s load-path option.

You might be also interested in emacs-overlay which pulls new melpa packages daily.

Cool!

So I’m trying it, and now I’ve got the problem that Emacs can’t find sqlite3, even though it’s installed. That seems like a different problem so I started a new thread to ask what’s up with that.

This is due to a recent change in org-roam to emacsql-sqlite3, which requires the system-level sqlite3, rather than the compiled executable from emacsql-sqlite. Similar to how magit pulls in git, you may need to do the following attr override currently not present in nixpkgs:

Good to know! Once I’m less confused about overlays I’ll try to do that.