A personal blog
NixOS is great. Well, until you open up a Common Lisp project, start a REPL, and well… you get an error about missing headers to some C library. We can make this work with a few steps.
NixOS doesn’t really let you install libraries globally and you have to install these dependencies manually for every project. Let’s do that now and see how we can make our REPL find them.
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.