SquircleSpace / ql2nix

Create a nix expression for loading quicklisp packages
MIT License
18 stars 3 forks source link

How to automate generation of a quicklisp expression? #2

Open lukego opened 5 years ago

lukego commented 5 years ago

Is there a nice way to fully automate creation of the Nix expression for a Quicklisp distribution? I mean to include building ql2nix and using a fresh copy of Quicklisp.

I am trying to formulate a script now but the immediate problem is how to build ql2nix? I would like to have nix-shell make it available but I don't understand how to write a nix expression for ql2nix: I can download it using fetchFromGitHub but how do I actually build it when the Nix expression to do so it part of the source archive?

If there is an easy way to do this I'd really love to have an example in the documentation. Just to avoid manually installing ql2nix and quicklisp each time and then losing track of which version I used to generate my dist...

lukego commented 5 years ago

I have been toying with this problem a little and here is what I have come up with: bootstrap.nix.

This is a fully automated script that uses nix-shell to run both Quicklisp and ql2nix to create a dependency definition for a specified set of Lisp packages. This is to solve the "How did I run ql2lisp last time?" problem.

I had tried to do this all within nix-build but disabling the sandbox seems a little too environment dependent so I switched to nix-shell.

SquircleSpace commented 4 years ago

Well, ql2nix should get into nixpkgs. That would make your life a bit easier! Unfortunately, you can't really automatically run ql2nix within nix itself. As you've already noticed, it requires breaking out of the nix sandbox to download quicklisp package info. To keep it nix kosher, you'd need your nix store to contain a quicklisp distribution pre-loaded with the packages you want to pass to ql2nix... but ql2nix is the tool that makes a partial quicklisp distribution pre-loaded with packages of interest!

In theory, if we generated a giant nixlisp distribution with every quicklisp package, you could run ql2nix against that. You'd have to pull down the entire quicklisp package set to run ql2nix, though. As someone who has had the joy of repeatedly downloading every quicklisp package, I can tell you it isn't a quick download.