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

**URL:** https://discourse.nixos.org/t/emacs-can-i-install-a-package-declaratively-after-trying-it-out-procedurally/7559
**Category:** Help
**Created:** [June 7, 2020, 6:04pm UTC](https://discourse.nixos.org/t/emacs-can-i-install-a-package-declaratively-after-trying-it-out-procedurally/7559 "2020-06-07T18:04:14Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![JeffreyBenjaminBrown](https://discourse.nixos.org/user_avatar/discourse.nixos.org/jeffreybenjaminbrown/32/1676_2.png) [@JeffreyBenjaminBrown](https://discourse.nixos.org/u/JeffreyBenjaminBrown)
#### Post date: [June 7, 2020, 6:04pm UTC](https://discourse.nixos.org/t/emacs-can-i-install-a-package-declaratively-after-trying-it-out-procedurally/7559/1 "2020-06-07T18:04:14Z")

</div>

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](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`](https://github.com/JeffreyBenjaminBrown/nixos-experiments/blob/8b4f2b53cc0d03c5c6e54febdb466699aa2e8850/emacs.nix) file, I won’t be able to make the declarative changes without borking something in my system.

---

<div class="post-metadata">

### Author: ![rasendubi](https://discourse.nixos.org/user_avatar/discourse.nixos.org/rasendubi/32/25_2.png) [@rasendubi](https://discourse.nixos.org/u/rasendubi)
#### Post date: [June 7, 2020, 9:24pm UTC](https://discourse.nixos.org/t/emacs-can-i-install-a-package-declaratively-after-trying-it-out-procedurally/7559/2 "2020-06-07T21:24:42Z")

</div>

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](https://github.com/nix-community/emacs-overlay) which pulls new melpa packages daily.

---

<div class="post-metadata">

### Author: ![JeffreyBenjaminBrown](https://discourse.nixos.org/user_avatar/discourse.nixos.org/jeffreybenjaminbrown/32/1676_2.png) [@JeffreyBenjaminBrown](https://discourse.nixos.org/u/JeffreyBenjaminBrown)
#### Post date: [June 8, 2020, 2:12am UTC](https://discourse.nixos.org/t/emacs-can-i-install-a-package-declaratively-after-trying-it-out-procedurally/7559/3 "2020-06-08T02:12:13Z")

</div>

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](https://discourse.nixos.org/t/emacs-cant-find-sqlite3/7566) to ask what’s up with that.

---

<div class="post-metadata">

### Author: ![jethrokuan](https://discourse.nixos.org/user_avatar/discourse.nixos.org/jethrokuan/32/864_2.png) [@jethrokuan](https://discourse.nixos.org/u/jethrokuan)
#### Post date: [June 8, 2020, 4:32am UTC](https://discourse.nixos.org/t/emacs-can-i-install-a-package-declaratively-after-trying-it-out-procedurally/7559/4 "2020-06-08T04:32:09Z")

</div>

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:

> **[Comparing NixOS:master...jethrokuan:emacs/sqlite3 · NixOS/nixpkgs](https://github.com/NixOS/nixpkgs/compare/master...jethrokuan:emacs/sqlite3)**
>
> Nix Packages collection & NixOS. Contribute to NixOS/nixpkgs development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![JeffreyBenjaminBrown](https://discourse.nixos.org/user_avatar/discourse.nixos.org/jeffreybenjaminbrown/32/1676_2.png) [@JeffreyBenjaminBrown](https://discourse.nixos.org/u/JeffreyBenjaminBrown)
#### Post date: [June 8, 2020, 4:28pm UTC](https://discourse.nixos.org/t/emacs-can-i-install-a-package-declaratively-after-trying-it-out-procedurally/7559/5 "2020-06-08T16:28:07Z")

</div>

Good to know! Once I’m less [confused about overlays](https://discourse.nixos.org/t/my-first-overlay-for-emacs/7570/1) I’ll try to do that.
