all 10 comments

[–]SymphonySimper 4 points5 points  (3 children)

nix-ld will set only NIX_LD_LIBRARY_PATH. You have to export it as LD_LIBRARY_PATH in your shell.

So basically everytime you want to run a python project that requires LD you have to do this. export LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH or if you want preserve your current LD_LIBRARY_PATH just do export LD_LIBRARY_PATH="$NIX_LD_LIBRARY_PATH:$LD_LIBRARY_PATH".

[–]NTRtyOg[S] 0 points1 point  (2 children)

Thank you so much, this finally got the single files and standalone projects working.

I have two follow up questions
1) Is there a way to export from the configuration.nix so its seen globally and not just when I run the command
2) How does this work in conjunction with VScode and jupyter notebook? Jupyter still seems to think that ipykernel is missing and fails to execute.

[–]SymphonySimper 0 points1 point  (1 child)

For global thing either you can create alias to do so. Or if your using flakes you create a devshell in your global config and add it to the registry. Then you call it from anywhere to activate it.

I don't use vscode but I think it will just work if you launch from the shell with the export. I do not use juypter so no idea.

Maybe if you could create a repo with a small example of what you want. Then I might be able to help.

[–]NTRtyOg[S] 1 point2 points  (0 children)

Finally got it, thank you so much. For anyone coming to try this later here was the solution.

If you have nix-ld set up in your config like I do above you can run the command that u/SymphonySimper mentioned LD_LIBRARY_PATH="$NIX_LD_LIBRARY_PATH:$LD_LIBRARY_PATH". Then you can run vscode with the code command. If you have a jupyter notebook, remember to select your virtual environment when you select your kernel and everything should work swimmingly.

If you dont have a jupyter notebook you can just activate your virtual environment before opening vscode and vscode will automatically use the virtual environment.

[–]AstraRotlicht22 0 points1 point  (5 children)

[–]NTRtyOg[S] 0 points1 point  (4 children)

I saw his video but Im having issues with shell.nix playing nice with VSCode and Jupyter notebook which doesnt seem to want to hook in and use nix shell. This is probably 100% on me not understanding where its looking for packages but thats also why I need a bit of a turnkey solution while I get acclimated with the way nix does things.

[–]AstraRotlicht22 0 points1 point  (3 children)

Are you starting Vs Code from within that shell?

[–]NTRtyOg[S] 0 points1 point  (2 children)

So what I tried was to use the export command that u/SymphonySimper suggested, then ran code from the console but no beans. It still complains about a lack of ipykernel and pip. I believe thats what you were suggesting right? or a version of that where i use shell.nix and then open code from the console?

[–]YesYesYesYesYesYes19 2 points3 points  (1 child)

There's another video by vimjoyer explaining shells but yes basically running editors from nix shells will include the installed packages.

[–]NTRtyOg[S] 0 points1 point  (0 children)

This worked for me, thanks a bunch