Honza Pokorný

A personal blog


How to use Common Lisp on NixOS with C libraries

If your project depends on a C library (e.g. openssl), you’ll need to jump through a few hoops.

In the root of your project, create a shell.nix file with the following:

{ pkgs ? import <nixpkgs> {} }:

with pkgs;

mkShell {
  buildInputs = [
    pkg-config
    openssl
  ];
}

Then, enter into that shell with nix-shell.

Start a slynk REPL in the nix shell. You can use a script like:

(push #p"~/.emacs.d/.local/straight/repos/sly/slynk/" asdf:*central-registry*)
(asdf:load-system :slynk)
(slynk:create-server :port 4008)

Run it with sbcl --load <script>.

Once the REPL is running, you can connect to it from Emacs with M-x sly-connect. That’s it.


This article was first published on November 19, 2024. As you can see, there are no comments. I invite you to email me with your comments, criticisms, and other suggestions. Even better, write your own article as a response. Blogging is awesome.