Open ncryptid opened 3 years ago
Hm. I only run NixOS and didn’t have issues like this. It may be bit rotten though, since I haven’t used it in a while. This is pretty far out of my mental cache and nothing springs to mind.
Can you attach your quicklisp setup.lisp and give me a pointer to the nixpkgs revision your system is built with? That should be enough for me to repro it on my side… when I finally have a little time to get back to working on this stuff, that is.
Alright, well I haven't touched the computer I was trying this on before in awhile now and am also not currently using NixOS (was getting in the way too much of doing lisp development). I did manage to get ql2nix to work, but I had to build the image with SBCL rather than using nix-build. My guess is that there's some weirdness going on with the nix-build version because when it gets built it passes in a bunch of different paths that my shell doesn't know about when I try to run it, because I'm also using a different SBCL than the one it's built with. Doing it entirely from a nix-shell might fix that, haven't tried it yet. Basically this bug is probably partly me just not knowing what I'm doing lol
While building the image manually, I also had to go through the step debugger and pass in different values for the nix files in the repo, because it kept trying to find each of them via the path /home/nyx/.cache/common-lisp/sbcl-2.1.7-linux-x64/home/nyx/Desktop/ql2nix/
. Same thing was happening when I tried to build SHCL in fact; not sure if that's specific to your stuff or if something is screwed up on my computer. But after doing that, it seems to work.
(PS: your deadname is still in the copyright headers)
On NixOS:
$ sbcl --eval '(print (sb-int:sbcl-homedir-pathname))' --quit
This is SBCL 2.1.9.nixos, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
#P"/nix/store/hmzadzczgn797lxzp94clgjy0l6fw8z9-sbcl-2.1.9/bin/../lib/sbcl/"
$ ql2nix --quicklisp-setup ~/quicklisp/setup.lisp --project-dir . sdwm
While evaluating the form starting at line 129, column 0
of #P"/home/bb010g/quicklisp/setup.lisp":
debugger invoked on a SB-INT:EXTENSION-FAILURE in thread
#<THREAD "main thread" RUNNING {1001858103}>:
Don't know how to REQUIRE SB-POSIX.
See also:
The SBCL Manual, Variable SB-EXT:*MODULE-PROVIDER-FUNCTIONS*
The SBCL Manual, Function REQUIRE
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [TRY-RECOMPILING ] Recompile impl and try loading it again
1: [RETRY ] Retry
loading FASL for #<CL-SOURCE-FILE "quicklisp" "impl">.
2: [ACCEPT ] Continue, treating
loading FASL for #<CL-SOURCE-FILE "quicklisp" "impl">
as having been successful.
3: Retry ASDF operation.
4: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the
configuration.
5: Retry ASDF operation.
6: Retry ASDF operation after resetting the
configuration.
7: [RETRY ] Retry EVAL of current toplevel form.
8: [CONTINUE ] Ignore error and continue loading file "/home/bb010g/quicklisp/setup.lisp".
9: [ABORT ] Abort loading file "/home/bb010g/quicklisp/setup.lisp".
(REQUIRE SB-POSIX NIL)
0] (sb-int:sbcl-homedir-pathname)
NIL
The ql2nix
image uses the same SBCL as sbcl
.
$ nix show-derivation =ql2nix | jq -r '.[].env.buildPhase'
ASDF_OUTPUT_TRANSLATIONS="(:output-translations :ignore-inherited-configuration (t \"$(pwd)\"))"
export ASDF_OUTPUT_TRANSLATIONS
NIX_LISP_SKIP_CODE=1 source "/nix/store/dv8p52v4l92rgiifby8wkiad6krd5vfn-cl-wrapper-script/bin/common-lisp.sh" || true
"/nix/store/dv8p52v4l92rgiifby8wkiad6krd5vfn-cl-wrapper-script/bin/common-lisp.sh" "$NIX_LISP_LOAD_FILE" "/nix/store/i06kq1bn6b3alay7sd498l186lph1qk8-ql2nix-build.lisp"
$ < /nix/store/dv8p52v4l92rgiifby8wkiad6krd5vfn-cl-wrapper-script/bin/common-lisp.sh
#!/nix/store/phqa311klldrcbwid1i22dwnpfc9dnma-bash-5.1-p8/bin/bash
source "/nix/store/dv8p52v4l92rgiifby8wkiad6krd5vfn-cl-wrapper-script"/bin/cl-wrapper.sh "${NIX_LISP_COMMAND:-$(/nix/store/qmn7m3wk8b1v1ljhb2dzyjh41d6ingp6-coreutils-9.0/bin/ls "/nix/store/hmzadzczgn797lxzp94clgjy0l6fw8z9-sbcl-2.1.9/bin"/* | /nix/store/qmn7m3wk8b1v1ljhb2dzyjh41d6ingp6-coreutils-9.0/bin/head -n 1)}" "$@"
See https://stackoverflow.com/questions/39133421/how-to-properly-save-common-lisp-image-using-sbcl. https://github.com/NixOS/nixpkgs/blob/a1b8eb4a30e32553f47ddfb185816f587ba08bbc/pkgs/development/compilers/sbcl/common.nix specifies a setup hook to support this, but only if purgeNixReferences
is flipped to true
.
When running
ql2nix --quicklisp-setup ~/quicklisp/setup.lisp --system-file ./my-scripts.asd
, I get the following error:my-scripts.asd and shell.nix look like this:
I have SBCL installed globally through configuration.nix. Trying to use ql2nix using the suggested method of cloning the repo and running nix-build produces the same error, and including other stuff in shell.nix like SBCL doesn't make a difference either. sb-posix is part of the standard SBCL libraries, but since it's meant to call out to a posix-compliant OS, it's also not surprising that it's having issues here since sometimes NixOS's attempts to trick programs into thinking they're running on a normal filesystem can fail with things like statically-linked binaries.
I'm not sure if this has been tested yet for NixOS or just the Nix package manager on a normal OS where everything would be in the expected locations on the filesystem. Support for lisp on NixOS is pretty awful so it's hard to debug this further on my own (I don't think there's even any documentation for lisp).