This repository is currently in alpha state. It has finished basic functionalities, but there is still room for improvement in API, and it completely lacks proper documentation:
- Functionalities: Good. The author builds his own config with twist, and the config is already almost as capable as the previous version which used straight.el. Additionally, NoMake is used in some packages (but it is being replaced with Rice). The basic use cases of twist.nix are covered.
- API: Unstable. It is mostly stable, but options may undergo changes in the future.
- Documentation: Poor. There is a branch. I will rework on it after I gain more confidence with the API.
Twist.nix is a Nix library for building Emacs configurations with packages. It is an infrastructure for configuration (solely with this library) and package development (with nomake).
This repository is an integral component of emacs-twist project. The goal of the project is to provide an alternative Emacs ecosystem that uses Nix. It is experimental, but also aims to be useful.
There are several other components under development. See the following table for comparison with corresponding options:
Twist component | Description | Counterpart |
---|---|---|
twist.nix (this repo) | Build machinery | package-build |
twist.el combined with nix3.el | Emacs package manager | straight.el, borg, etc. |
+nomake+ rice | Package development | cask |
As a Nix library, Twist.nix is also an alternative to the Emacs wrapper (i.e. emacsWithPackages
) on NixOS.
Twist.nix depends on Nix utility libraries, but it does not depend on the wrapper.
The biggest difference betweeen twist and the wrapper is that twist is capable of building packages from upstream source repositories. On the contrary, the wrapper fetches pre-built package archives from for most ELPA and MELPA packages, which means it indirectly depends on package-build for MELPA packages.
Here building a package means mapping files into a flat directory, which takes little time. By being smarter in building packages from sources, twist has an advantage in working around existing packages and adding custom packages, like straight.el. It also allows usage for package development, which is what package-build does to cask.
With twist, it is easier to lock and update individual packages, because it tracks package versions in flake.lock. Twist.el, the package management frontend for Twist, should hopefully provide an experience on par with straight.el.
Twist can discover and build packages from the following sources:
- MELPA recipes (Git)
- ELPA external/core packages (Git)
- ELPA/MELPA archives (single elisp files and tarballs)
- EmacsMirror (Git)
To add custom packages to your configuration, you only have to define MELPA recipes and commit them to your repository. It can already build configurations with a few hundreds of packages from various registries (see examples).
Twist is a Nix re-implementation of package-build and replicates its build logic. It is also heavily influenced by the Emacs wrapper in nixpkgs, though twist was written from scratch and different in implementation.