How to Install GNU Emacs on NixOS Latest

This tutorial will guide you through the process of installing GNU Emacs on NixOS Latest. We will be using the official Emacs website to download the source code and then build Emacs from scratch using the Nix package manager.

Prerequisites

Before we install GNU Emacs, please make sure that you have the following prerequisites installed and configured on your system:

If any of the above components are missing or not installed, please follow the instructions provided by your operating system or package manager to install them.

Installing GNU Emacs

To install GNU Emacs on NixOS, we will first download the source code from the official website and then build Emacs from scratch using the Nix package manager. Follow the steps below to install GNU Emacs:

  1. Open a terminal window on your NixOS system.
  2. Navigate to the directory where you want to install Emacs.
  3. Clone the Emacs source code from the official website using Git:
$ git clone git://git.savannah.gnu.org/emacs.git
  1. Change directory into the Emacs source code directory:
$ cd emacs
  1. Checkout the latest release tag for the Emacs version you want to install. For example, if you want to install Emacs version 27.2, run the following command:
$ git checkout emacs-27.2
  1. Make sure Nix is installed and configured on your system. You can check if Nix is installed by running the following command:
$ nix-env --version
  1. Build Emacs from scratch using Nix:
$ nix build -f default.nix emacsPackages.emacs
  1. The build process may take some time depending on the speed of your system. Once the build process is complete, you will have a binary file named emacs in the result/bin/ directory:
$ ls result/bin/emacs
  1. To run Emacs, simply execute the emacs binary:
$ ./result/bin/emacs

Congratulations! You have installed GNU Emacs on NixOS.

Conclusion

This tutorial has shown you how to install GNU Emacs on NixOS using the Nix package manager. By following the steps outlined above, you should now have a working installation of Emacs on your system. Happy coding!

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!