An Emacs major mode for editing Nix expressions.
Branch: master
Clone or download
etu Move the logic for indentation of first line of file
This moves the logic of indentation of the first line of the file from
the logic of indenting the first line of a block of any kind. This
greatly simplify the code in the block function and it doesn't make
sense to do that check that late either since it's a simple check that
hardly can go wrong.
Latest commit 1e53bed Jan 19, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests fix-issue-72: Check the correct element from syntax-ppss Jan 19, 2019
Cask Add dependency on json-mode Oct 20, 2018
LICENSE Create LICENSE Aug 17, 2016
nix-build.el Cleanup nix-build.el Aug 22, 2018
nix-company.el Reorganization Jul 14, 2018
nix-drv-mode.el Only show derivations in nix store Aug 22, 2018
nix-edit.el Add nix-edit.el Aug 22, 2018
nix-format.el Fix typo: rustfmt -> nixfmt Aug 20, 2017
nix-instantiate.el Package linting Aug 22, 2018
nix-log.el Package linting Aug 22, 2018
nix-mode-mmm.el Update Homepage in .el files Feb 15, 2018
nix-mode.el Move the logic for indentation of first line of file Jan 19, 2019
nix-prettify-mode.el Update Homepage in .el files Feb 15, 2018
nix-repl.el Add alias for nix-repl-show Jul 31, 2018
nix-search.el Add nix-read-file & nix-read-attr Aug 22, 2018
nix-shebang.el Reorganization Jul 14, 2018
nix-shell.el Add nix-read-file & nix-read-attr Aug 22, 2018
nix-store.el Package linting Aug 22, 2018
nix.el Package linting Aug 22, 2018


MELPA MELPA Stable Build Status

An emacs major mode for editing nix expressions.


A quick list of what is provided.


nix.el contains some miscellaneous tools for Nix developers. Interactive functions include:

  • nix-unpack - unpack source of a Nix attribute.

    To use this just type:

    M-x nix-unpack

    Followed by your Nix path & attribute path.

  • nix-build - build a Nix derviation.

    This is meant to work similarly to M-x compile. It will use your current directory & build it if there is a default.nix there.

nix.el also provides some basic functions for interfacing with Nix. Some variables are provided to point to the Nix binaries that can be used in Lisp code:

  • nix-executable
  • nix-build-executable
  • nix-instantiate-executable
  • nix-store-executable
  • nix-shell-executable

Other useful functions for Lisp scripts are provided:

  • nix-system - Get the current system, detected by Nix


nix-repl.el has two purposes.

First, it provides an interface for completion, used by nix-company.el.

Second, it provides an interactive function to open an repl. You can open this with:

M-x nix-repl


This repository is based off of the nix-mode.el file originally located in the Nix repository at misc/emacs/nix-mode.el. Please see the CHANGELOG file for a list of changes.

Other Emacs packages

@shlevy has an excellent package for integrating nix-shell into emacs. It is available at shlevy/nix-buffer.

@travisbhartwell also has some package dealing with Nix. They are available at travisbhartwell/nix-emacs.