Closed okanua closed 2 years ago
I ran into the same problem with installing Emacs with pkgs.emacsPackagesNg.org-plus-contrib
.
Result of M-x org-version
:
Org mode version 9.4.6 (9.4.6-796-ge68375.dirty-elpa @ /nix/store/7i11qsyqz6cxaa09cvz9jhrgfdlk90a9-emacs-packages-deps/share/emacs/site-lisp/elpa/org-20210929/)
I also get the following error:
IMPORTANT: please install Org from GNU ELPA as Org ELPA will close before Org 9.6
I had the same issue and started digging a little, starting with the following minimal example:
;; emacs.el
(require 'use-package)
(use-package org
:ensure t)
# default.nix
with (import <nixpkgs> { overlays = [ (import /home/dkellner/dev/emacs-overlay/.) ]; });
emacsWithPackagesFromUsePackage {
config = ./emacs.el;
override = epkgs: epkgs // {
org = epkgs.elpaPackages.org;
};
}
This seems to work as expected:
$ nix-build && result/bin/emacs -Q -l emacs.el --batch -f org-version
/nix/store/40qkx5kwq2dy42c5p83hw9lkr1bvdqqk-emacs-with-packages-27.2
Org mode version 9.5 (9.5-g0a86ad @ /nix/store/33ifjnbwrsayax3ln6rk1a362y0knv7k-emacs-packages-deps/share/emacs/site-lisp/elpa/org-9.5/)
Now, adding another MELPA package depending on org changes things:
;; emacs.el
(require 'use-package)
(use-package org
:ensure t)
(use-package org-super-agenda
:ensure t)
$ nix-build && result/bin/emacs -Q -l emacs.el --batch -f org-version
/nix/store/z5dpfd18kb22lcwn9n492nllw0cwnw3q-emacs-with-packages-27.2
Org mode version 9.4.6 (9.4.6-796-ge68375.dirty-elpa @ /nix/store/sga43inxihdppqcd2xg0m7jfw0nq1b0h-emacs-packages-deps/share/emacs/site-lisp/elpa/org-20210929/)
Now, list-load-path-shadows
shows that org-20210929
is hiding org-9.5
. The "emacs-packages-deps" derivation indeed contains two versions of org, and it seems that the items in load-path
are in the same alphabetical order as the directories in the derivation's share/emacs/site-lisp/elpa/
. Therefore, org-20210929
preceding org-9.5
and shadowing it.
I've tried different things so that the older org version does not end up in the derivation at all, but I could not get it to work:
Overriding orgPackages
(which is the source of the older version):
with (import <nixpkgs> { overlays = [ (import /home/dkellner/dev/emacs-overlay/.) ]; });
emacsWithPackagesFromUsePackage {
config = ./emacs.el;
override = epkgs: epkgs // {
org = epkgs.elpaPackages.org;
orgPackages = orgPackages // {
org = epkgs.elpaPackages.org;
};
};
}
Removing orgPackages
from the overlay itself results in an even older version of org failing to download (https://orgmode.org/elpa/org-20210519.tar)
modified default.nix
@@ -164,7 +164,7 @@ in
};
epkgs = esuper.override {
- inherit melpaStablePackages melpaPackages elpaPackages orgPackages;
+ inherit melpaStablePackages melpaPackages elpaPackages;
};
in
So, lacking knowledge of the internal workings of the overlay, I'm currently just fixing load-path
after the fact, which is ugly but works fine for now:
(require 'dash)
(defun dkellner/remove-old-org-mode (paths)
(-remove
(lambda (path) (string-match "/org-20210929" path))
paths))
(setq load-path (dkellner/remove-old-org-mode load-path))
I'm also having the same issue - I don't know enough about the internals to be actually helpful, but I wanted to link this related discussion on the NixOS Discourse https://discourse.nixos.org/t/declarative-emacs-config-how-to-use-gnu-elpa-and-more-fundamentally-how-to-explore-sub-attributes-of-the-epkgs-attribute/16244 , maybe the extra info helps.
I also had this issue, it seems like if you remove repos/org
and orgPackages
in the default.nix
leaving it like:
emacsPackagesFor = emacs: (
(super.emacsPackagesFor emacs).overrideScope' (
eself: esuper:
let
melpaStablePackages = esuper.melpaStablePackages.override {
archiveJson = ./repos/melpa/recipes-archive-melpa.json;
};
melpaPackages = esuper.melpaPackages.override {
archiveJson = ./repos/melpa/recipes-archive-melpa.json;
};
elpaPackages = esuper.elpaPackages.override {
generated = ./repos/elpa/elpa-generated.nix;
};
# orgPackages = esuper.orgPackages.override {
# generated = ./repos/org/org-generated.nix;
# };
epkgs = esuper.override {
inherit melpaStablePackages melpaPackages elpaPackages; # orgPackages;
};
in
epkgs
// super.lib.optionalAttrs (super.lib.hasAttr "nongnuPackages" esuper) {
nongnuPackages = esuper.nongnuPackages.override {
generated = ./repos/nongnu/nongnu-generated.nix;
};
} // {
xelb = mkExDrv eself "xelb" {
packageRequires = [ eself.cl-generic eself.emacs ];
};
exwm = mkExDrv eself "exwm" {
packageRequires = [ eself.xelb ];
};
}
)
);
It works as it should, I guess it will download the package from elpa instead of orgmode.org
Before:
M-x org-version
gives: Org mode version 9.4.6 (9.4.6-796-ge68375.dirty-elpa @ /nix/store/...
And telling me IMPORTANT: please install Org from GNU ELPA as Org ELPA will close before Org 9.6
After:
M-x org-version
gives: Org mode version 9.4.6 (9.4.6-13-g4be129-elpa @ /nix/store/...
And it doesn't tell me anything
I have the same issue, and got org-version 9.4.6 with EmacsGit:
Org mode version 9.4.6 (9.4.6-796-ge68375.dirty-elpa @ /nix/store/lxxvld58raa8gih13b6748kin0c1v9n8-emacs-packages-deps/share/emacs/site-lisp/elpa/org-20210929/)
Emacs version:
GNU Emacs 29.0.50 (build 1, x86_64-apple-darwin20.6.0, NS appkit-2022.60 Version 10.16 (Build 20G224))
when open org-mode, will get this message in Emacs:
IMPORTANT: please install Org from GNU ELPA as Org ELPA will close before Org 9.6
I have the same nix config as @okanua
@Eason0210
Try what I commented above, let's see if it works for everyone.
PS: I'm using emacsPgtk, seems to be the same version as yours, 29.0.50
Try what I commented above, let's see if it works for everyone.
@aru-hackZ Thanks for your advice. As you described above, with your solution will get org 9.4.6, but I want to use the built in version org 9.5 instead with emacs 29.
So, I think we should fix it in the future.
Also had this problem. With the home-manager Emacs module you can override the used org
package with:
programs.emacs.overrides = self: super: {
org = self.elpaPackages.org;
};
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
Also had this problem. With the home-manager Emacs module you can override the used
org
package with:programs.emacs.overrides = self: super: { org = self.elpaPackages.org; };
That sure is a better way to do it than mine, still have to learn how to use self and super, thanks!
The orgPackages
sets have been removed both from nixpkgs and here, this is fixed.
I have been trying to setup a feature of org-mode 9.5 (org-cite), but it would appear that my emacs is using the "wrong" version of org-mode.
When I run org-version the response is "Org mode version 9.4.6 (9.4.6-13-g4be129-elpa @ /nix/store/7kxvd0sxsd9zj5iyfxqvmi15345v8ikd-emacs-packages-deps/share/emacs/site-lisp/elpa/org-20210920/)".
As extra context, when i run version, i get "GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0)", and list packages lists both "org 20210920 external" and "org 9.5 built-in"
I am a relatively new user of both emacs and nixos, so I'm sure I've made an error in how I've set it up. Below are some fragments from my nix setup (edited for brevity). I would be grateful if anyone was able to point me in the right direction.
I'm declaring the input in flake.nix like this:
and then adding the overlay
overlays = [ inputs.emacs-overlay.overlay ];
Then in home manager make the following setup: