How to install Emacs 27 in NixOS?

Hi folks, I just switched from Manjaro to NixOS and I need a Emacs 27 instead of the default version 26.

Is there a simple way, I mean a piece of configuration that I can copy/paste. Appreciate for the help!

(Chinese input method is not ready yet, bear with my English)

You can write nix package by yourself, but you can also use emacs-overlay for convenience.

Import this overlay, than install emacsUnstable(for 27.0.91).

You may also install emacsGit (master branch)

P.S. I trash my nix config after I found guix, so I 'm sorry for the missing example

1赞

I’ve no experience, but see someones use it:

and discussion on reddit

https://www.reddit.com/r/emacs/comments/ad6kig/building_an_emacs_configuration_using_nixpkg/

Thanks, It works.

However it will download everytime I rebuild configuration, how to prevent this?

I also want to know, where is the documentation for those nix APIs in configuration.nix.

你是指下载什么?只知道nix会用Github下载zip的接口去下载emacs tarball。

暂时还没有统一的API文档查阅接口,各种函数的用法分散来nix manual,nixpkg manual,nixos manual等等等……。只知道有个options查询接口

https://nixos.org/nixos/options.html#


可以加群咨询对Nix更熟悉的用户 https://t.me/NixOS_zh

I mean download this file https://github.com/nix-community/emacs-overlay/archive/master.tar.gz

Looks like there’s no cache for it :frowning:

A hacky solution: clone repo to your disk, then set the overlay source to the git repository in your file system.

You may need to dig into the source of Nix.