Declarative Emacs config: How to use GNU ELPA? And more fundamentally, how to explore sub-attributes of the `epkgs` attribute?

(If I’m using the word “attribute” wrong, please correct me.)

My Emacs config has the following three lines (in different places):

    with epkgs.melpaStablePackages; [
    with epkgs.melpaPackages; [
    with epkgs.elpaPackages; [

Recently I started getting this error whenever I open an org file in Emacs:

IMPORTANT: please install Org from GNU ELPA as Org ELPA will close before Org 9.6

Org-mode is built into Emacs, so org is not part of my config, but I tried putting org in the with epkgs.elpaPackages; [ section, and while it built fine, the error didn’t go away. This leads me to suspect that epkgs.elpaPackages does not refer to GNU ELPA, but to whatever the other ELPA is.

So my first question is:
(1) Is there something like epkgs.elpaPackages that I can install org from, to make the error go away?

I found the nixos-option package, which seemed like it might be helpful. But I could not for the life of me figure out what argument to feed it. Typing like an infinite number of monkeys, I eventually found something close. But whereas in some cases the nixos-option output is nice and readable:

jeff@jbb-dell:jbb$ nixos-option xdg
This attribute set contains:
autostart
icons
menus
mime
portal
sounds

in this case it just seems to dump every package on me:

jeff@jbb-dell:jbb$ nixos-option environment.systemPackages.emacsWithPackages
Note: showing environment.systemPackages instead of environment.systemPackages
.emacsWithPackages
Value:
[
  «derivation /nix/store/wy8vd1g9dy8ikb5c6v9rgv935pvkjnh1-emacs-with-packages-
27.2.drv»
  «derivation /nix/store/imyar35162i6rrwdy78byfwjl6r0g5bl-mg-6.9.drv»
  «derivation /nix/store/f8c63bz68nqk1ins8rgsb5xjcnrchppc-atom-1.58.0.drv»
  ...

  «derivation /nix/store/87sjj2lzvr4lq0rvpxwrb658qx4jql0b-shared-mime-info-2.1.drv»
  «derivation /nix/store/9xcrbk580hvpgx7f8f25p4f95rjdhsvg-fontconfig-2.13.94.drv»
]

Default:
[ ]

Type:
"list of packages"

Example:
{
  text = "[ pkgs.firefox pkgs.thunderbird ]";
}

Description:
''
  The set of packages that appear in
  /run/current-system/sw.  These packages are
  automatically available to all users, and are
  automatically updated every time you rebuild the system
  configuration.  (The latter is the main difference with
  installing them in the default profile,
  <filename>/nix/var/nix/profiles/default</filename>.
''

Declared by:
[ "/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/config/system-path.nix" ]

Defined by:
[
  "/etc/nixos/packages.nix"
  "/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/services/x11/desktop-manage
rs/plasma5.nix"
  "/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/virtualisation/docker.nix"
  ...

  "/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/config/console.nix"
  "/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/config/xdg/mime.nix"
  "/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/config/fonts/fontconfig.nix
"
]
jeff@jbb-dell:jbb$

That brings me to question (2):

(2) How can I determine the fully qualified name of what my config calls epkgs, in order to explore its sub-attributes with nixos-option? Or if I can’t, how else can I explore its sub-options?

1 Like

You can use the REPL to explore emacsPackages using TAB-complete. That is basically what gets passed as epkgs.

1 Like

emacs.pkgs.elpaPackages refers to GNU ELPA, the issue is maybe that the internal org mode takes precedence over the ELPA one?

Yes, it usually does, and it is really hard to change that.

Having org mode built-in makes it hard to update it without updating Emacs. I really was not a friend of that.

Since then I have problems staying on latest and grates org mode.

You can use the REPL to explore emacsPackages using TAB-complete. That is basically what gets passed as epkgs .

How? I tried following the wiki article on it and still it wouldn’t tab complete the word “environment”. (I wasn’t sure whether it cares where it’s launched from, so just to be sure it had access to “nixpkgs” I launched from my clone of that.)

[jeff@jbb-dell:~/nix/nixpkgs]$ git remote -v
origin  git@github.com:JeffreyBenjaminBrown/nixpkgs.git (fetch)
origin  git@github.com:JeffreyBenjaminBrown/nixpkgs.git (push)
upstream        https://github.com/NixOS/nixpkgs (fetch)
upstream        https://github.com/NixOS/nixpkgs (push)

[jeff@jbb-dell:~/nix/nixpkgs]$ nix repl '<nixpkgs>'
Welcome to Nix 2.4. Type :? for help.

Loading '<nixpkgs>'...
Added 15437 variables.


[jeff@jbb-dell:~/nix/nixpkgs]$ git remote -v
origin  git@github.com:JeffreyBenjaminBrown/nixpkgs.git (fetch)
origin  git@github.com:JeffreyBenjaminBrown/nixpkgs.git (push)
upstream        https://github.com/NixOS/nixpkgs (fetch)
upstream        https://github.com/NixOS/nixpkgs (push)

[jeff@jbb-dell:~/nix/nixpkgs]$ nix repl '<nixpkgs>'
Welcome to Nix 2.4. Type :? for help.

Loading '<nixpkgs>'...
Added 15437 variables.

nix-repl> :l <nixpkgs/nixos>
Added 6 variables.

nix-repl> env  # then I pressed TAB
envchain     envdir       envoy        envypn-font
envconsul    envelope     envsubst

Not encironment, I said emacsPackages.

Aha! Thanks. I was trying to fully qualify the name, which I thought would start with environment.

The repl let’s you explore the packageset, but not options (at least not without some weight lifting)

1 Like

One way to work around it might be to use nix-community’s emacs-overlay to get an unstable Emacs where this is no longer an issue.

Hosted by Flying Circus.