You know for years my elders have been telling me to use #!/usr/bin/env bash in my scripts.
And I was like 'nah. All distros put bash in the same place!'
Then NixOS came along and said 'hold my beer'
You know for years my elders have been telling me to use #!/usr/bin/env bash in my scripts.
And I was like 'nah. All distros put bash in the same place!'
Then NixOS came along and said 'hold my beer'
> envfs sets up a FUSE filesystem (i.e. virtual filesystem) at /bin and /usr/bin that pretends every binary available at your PATH can be found at these directories.
https://fzakaria.com/2025/02/26/nix-pragmatism-nix-ld-and-envfs
I have been daily driving NixOS for nearly a year on my wonderful frame.work laptop; and have been a Nix-enthusiast for ~5 years. Prior to NixOS, I primarily ran Nix atop my Debian distro, single-user mode, which worked suprisingly well. I loved the simplicity but I was blissfully unaware of how non-hermetic I was! 馃槺
@thelinuxcast @zstg
```services.envfs.enable
Fuse filesystem that returns symlinks to executables based on the PATH of the requesting
process. This is useful to execute shebangs on NixOS that assume hard coded locations in
locations like /bin or /usr/bin etc.
Type: boolean
Default: false
Example: true
Declared by:
<nixpkgs/nixos/modules/tasks/filesystems/envfs.nix>```
from man configuration.nix
@zstg @thelinuxcast Used it myself and didn't have problems, but someone mentioned it got them stuck at boot or what at some point, so I deactivated it again.
https://gitlab.com/nobodyinperson/nixconfig/-/commit/e7db34334fe3a4d74949b5e534550e2b9dc4ac5f
I think the BSDs always put bash in /usr/local/bin, because it's not a part of the base OS, and they like to differentiate things like that.
That said, I always make a symlink.
@thelinuxcast That burned me a lot. I had to update a lot of my NPM packages, local scripts, and Just recipies to use env after I switched (I didn't know about the setting for the symlinking until today).
The other thing that catches me is you can't hard-code paths in programs at all. Sometimes its simple to change, but a lot of programs don't use PATH searching at all but also make that assumption.