I’m developing a package that includes some Lua library files. Supposing my git repository is in /home/dan/src/example/, this means I need to set the environment variable LUA_PATH to /home/dan/src/example/lib/?.lua - and I’d like to do this in shell.nix
My first thought was to use ./. but that expands to a store path not to the “local” directory. I’d rather be able to use an absolute path here than just lib/?.lua which will fail as soon as I cd into a subdirectory
nix paths work like that:
If you reference something as a path and not a string it gets copied to the nix-store so it doesn’t change it output when you run it multiple times.
when you convert the current directory to a string you skip to copy to nix-store step and get the current directory as string.
I think so too, it’s a pitfall many of my nix-muggle colleagues run into when using dev shells. At least there should be a something one can set directly in flake.nix (or mkShell) to have it default to impure like:
nixConfig.devShell.impure = true; # or something