An Emacs major mode for editing Nix expressions.
Branch: master
Clone or download
Pull request Compare This branch is 12 commits behind NixOS:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests
.gitignore
.travis.yml
CHANGELOG.md
Cask
LICENSE
Makefile
README.md
default.nix
nix-build.el
nix-company.el
nix-drv-mode.el
nix-edit.el
nix-format.el
nix-instantiate.el
nix-log.el
nix-mode-mmm.el
nix-mode.el
nix-mode.org
nix-prettify-mode.el
nix-repl.el
nix-search.el
nix-shebang.el
nix-shell.el
nix-store.el
nix.el

README.md

nix-mode

MELPA MELPA Stable

An emacs major mode for editing nix expressions.

Submodes

A quick list of what is provided.

nix.el

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

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

Origins

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.