CL2NIX is a tool to assist in maintaining Common Lisp in Nix.
Currently (December, 2021), the support for Common Lisp in Nixpkgs is far from perfect:
- Quicklisp is used. I do like Quicklisp and I am very thankful to its creator for making Common Lisp system distribution easy and maintaining the dist. However, in the case of Nix, we already have a package manager.
- Generating dists with Quicklisp can interfere with local Quicklisp installation.
- The generator tool only works inside of a nix-shell, providing build dependencies for the systems being checked. Do we actually have to build everything before resolving lisp dependencies? We will find out later.
- Adding new lisp systems to Nixpkgs is unintuitive. Nix-shells make this worse, when there is a system missing from Nixpkgs, because we are forced to define lisp dependencies by hand if they are missing as well.
- Lisp compilers miss the
withPackages
option, that, for example, GHC and Python have. Every lisp system is isolated in the store and collected for the compiler by the clwrapper script. As it seems to me, this breaks the rules that exist for other languages.
- CL2NIX should only depend on ASDF.
- CL2NIX should be able to:
- Generate a package expression:
- Read a system description in quicklisp-projects format
- Prefetch the system, save its URL, revision and sha256 sum
- Find the system’s .asd files, read them, extract the defined system names and lisp dependencies for each system
- Use the gathered information to generate a lisp package expression for Nix
- Generate an attrset for lisp packages:
- Read a list of system descriptions in quicklisp-projects format
- Check that lisp dependencies are satisfied, warn if not and log the missing systems
- Generate and collect expressions, then save to a file
- Generate a package expression:
The nix expression should allow for overrides to provide external build- and runtime dependencies. If an attrset is created, overrides are written by hand in quicklisp-to-nix-overrides.nix manner.
New wrappers should be written to allow for intuitive lisp usage with Nix
(withPackages
). Hopefully, we will be able to reuse the compiler definitions
from Nixpkgs. It may also be viable to create different attrsets for different
compilers.
Broken lisp packages should be marked.
- Quicklisp:
- Familiar
- Nix-shells still need to be written (for Roswell also)
- Roswell:
- Familiar
- Not really sure if .ros scripts work right
- The installation process is unreliable. For me manually changing the config file worked on one machine, but on the other one it was resetting
- Ql2nix:
- Builds an environment with lisp systems, which are not isolated
- When I tried it, there were systems that it could not build
- Minor changes in nix-shell required to rebuild the entire environment
I did not track the project for quite some time, things may have changed.
- cl-nix-project-skeleton was my attempt to reuse the facilities available in Nixpkgs to build a nix-shell. It is a mess, but it gave me some insights
Apparently some descriptions in the quicklisp-projects repository are outdated, so check also cldm-repo.
Output paths should be collected and put into an environment variable (NIX_SINGLE_FILE_SYSTEMS
).
Lisp compiler needs to get a function to find single-file libraries through NIX_SINGLE_FILE_SYSTEMS
. The function symbol is put into *MODULE-PROVIDER-FUNCTIONS*
.
This is not required for ASDF systems, as those are already managed by ASDF and CL_SOURCE_REGISTRY
.