/twist.nix

A Nix library for building a set of locally-freezed elisp packages

Primary LanguageNixGNU General Public License v3.0GPL-3.0

Twist Nix Library

https://github.com/emacs-twist/twist.nix/actions/workflows/test.yml/badge.svg

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 componentDescriptionCounterpart
twist.nix (this repo)Build machinerypackage-build
twist.elEmacs package managerstraight.el, borg, etc.
nomakePackage developmentcask

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).

Status

  • 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. 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. The author wants to work on his own problems first, and he is not motivated enough to work on the documentation. All the information is currently kept in his mind.

I am the author. Maybe I will further work on documentation and finalize the API after org-dog has got basic features. For now, I will continue with minor updates needed for my own use.

Credits

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.