fission-codes / fission

Fission CLI & server
https://runfission.com/docs
119 stars 14 forks source link

Migrate nix environment to flakes #604

Closed walkah closed 2 years ago

walkah commented 2 years ago

Closes #584

Adding flake.nix for faster nix-shell startup and better version pinning. In the process, generally cleaning up some issues (mostly around aarch64-darwin):

matheus23 commented 2 years ago

I can nix-shell successfully, but I can't run build:

[...]
Only                             > configure
Only                             > /home/philipp/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.7: error while loading shared libraries: libgmp.so.10: cannot open shared object file: No such file or directory
SHA                              > configure
SHA                              > /home/philipp/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.7: error while loading shared libraries: libgmp.so.10: cannot open shared object file: No such file or directory
StateVar                         > configure
StateVar                         > /home/philipp/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.7: error while loading shared libraries: libgmp.so.10: cannot open shared object file: No such file or directory
appar                            > configure
appar                            > /home/philipp/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.7: error while loading shared libraries: libgmp.so.10: cannot open shared object file: No such file or directory
Progress 4/305       
[...]

I have a file /usr/lib/libgmp.so.10. Is there something in the nix-shell preventing it from picking that one up? Should there be a libgmp.so.10 in the include path inside the nix-shell perhaps?

walkah commented 2 years ago

I can nix-shell successfully, but I can't run build:

One change is that we now run stack in a "pure" nix shell ... which seems to be working in our CI environments. My best guess is that you have a cached build that was built against your system libgmp (which will be unavailable in the pure shell). Can you try a clean build? (I know that's a long build)

matheus23 commented 2 years ago

I'm feeling dumb. How would I clean my cache? I've tried removing all .stack-work directories I could find, but I get the same errors.

I also tried nix-shell --pure. That loads fine but when I run build I get an error about nix-shell not being on my PATH. When I just add it, then it goes back to the previous error. You said that libgmp.so.10 should be unavailable from a pure shell. I think that's the case: The error says it can't find libgmp.so.10.

I saw that behind the build command there's stack build --nix. I also tried running stack build without --nix directly, but that didn't work.


Okay, I removed my ~/.stack directory now. That seems to run something. Will report back soon (maybe tomorrow).

walkah commented 2 years ago

Removing my ~/.stack directory and re-running everything worked! :)

Awesome! Glad to hear it! @expede you okay if I merge this? (I know you were testing it out too)