hraban / cl-nix-lite

Common Lisp module for Nix, without Quicklisp
GNU Affero General Public License v3.0
29 stars 2 forks source link

Add a formatter #1

Closed pinage404 closed 5 months ago

pinage404 commented 1 year ago

Hi,

Thanks for this project, it helps me to understand (a bit more) the Common Lisp ecosystem

I have been trying (for hours) to set up an environment for Common Lisp with tests without needing to install things that have side effects (putting dependencies in the home folder)

Thanks to this project, i have done it !


I would like to add an automatic formatting tool

It seems that none of the formatting tools listed on the Awesome Common Lisp are integrated into this project

I have tried but without success


How to format Common Lisp sources with an automatic tool using this project ?

hraban commented 1 year ago

Hi @pinage404 , nice work you did it entirely right.

I had a look at those two projects, and in particular sblint will be very tough to use in Nix because it (currently) relies very heavily on Roswell. Roswell is as good as completely incompatible with Nix, because in a way it kinda does what Nix does, but in a stateful, system modifying way. sblint puts some of its arg handling code in the roswell glue layer, so it really can't be used without roswell, as-is.

The only way forward for sblint would be to submit a patch that extracts that code into a stand-alone file which parses its args, and have only a very very thin Roswell layer which just calls that function. Then to have it support binary-file compilation using asdf (see some of the examples in this project). But obviously outside the scope of your project.

As far as trivial-formatter is concerned, I'm a bit confused by their actual "entrypoint". I guess you have to load it into an image and call it interactively? Depending on the final workflow, the resulting Nix solution would look very different. If you're just trying to load this into SLIME, that's more of a "make the source code available in my asdf:central-registry situation: there's actually a solution for that in this repo as well: examples/emacs-slime. However, ifyou're trying to hook this up in your flake so you can just run nix flake check or nix run .#lint on CI (which I think is a great idea), then you'd need to find a way to run trivial-formatter as a stand-alone binary first, which takes filename(s) as argument(s) on the command line. I don't think it (currently) supports that?

Anyway, you definitely found a tough one to start with :P good luck and lmk if you keep plugging away at it and need more help.

pinage404 commented 5 months ago

I added a formatter using lisp-format

hraban commented 5 months ago

I added a formatter using lisp-format

Interesting I will have a look!

hraban commented 5 months ago

Cool project, though not a CL project so not suitable for actual inclusion in this repository. But glad it worked out as an add-on for your system!