4 ms·
NixOS: Intentionally breaks compatiblity with a lot of scripts and binaries due to not having /usr/bin/bash and not putting libraries in a standard location des
by charcircuit 3y ago
NixOS: Intentionally breaks compatiblity with a lot of scripts and binaries due to not having /usr/bin/bash and not putting libraries in a standard location despite the fact there is still /usr/bin/env and a bunch of symlinks to things under some obscure folder in /run. It will make sure that every user has to learn Nix because you won't be able to run things from the internet without going through Nix's documentation trying to figure how to package something when you just want to run it and get on with your day.
If you enjoy packaging then this OS is for you.
- dwb 3y agoAnd despite all that, it still feels like a breath of fresh air.
- Aerbil313 3y agoFully agree. It’s all a big hack and workaround, but still easier to drive than any other distro, because you can’t mess your system up.
- paulgdp 3y agoBut you can use `envfs` to "restore" that compatibility ;) Or something heavier like `steam-run`
- charcircuit 3y agoI end up just using patchelf since getting the alternatives working is harder. I would prefer if NixOS is going to give up on moving everything into /nix that it just makes symlinks in the standard paths so users don't need to find something to do it for them.
- pxc 3y agoI have thought this, too. But if that includes libraries or even stuff that would go under /usr/share, that could cause breakage on NixOS updates for software that expects specific versions of things at those paths. This is probably less of an issue for executable paths, but if people really expect to be able to ./configure && make on NixOS, NixOS needs to have a whole different release cycle. Ideally you'd probably still want atypical prefixes, if just like `/usr/1.0/...` or something so you could have multiple releases (and software compiled against them) live side-by-side. I think that could work really well, but it would be a huge maintenance burden and there's nobody up for it right now. And it would still involve some of the pain we currently have with unusual filesystem structure.
- rekado 3y agoWith Guix we use `guix shell --container --emulate-fhs` to temporarily wire things up to their expected locations: https://guix.gnu.org/en/blog/2023/the-filesystem-hierarchy-standard-comes-to-guix-containers/ https://guix.gnu.org/en/blog/2023/the-filesystem-hierarchy-s...
- charcircuit 3y agoguix shell --container --network --emulate-fhs \ --development ungoogled-chromium gcc:lib \ --preserve='^DISPLAY$' --preserve='^XAUTHORITY$' --expose=$XAUTHORITY \ --preserve='^DBUS_' --expose=/var/run/dbus \ --expose=/sys/dev --expose=/sys/devices --expose=/dev/dri \ -- ./VSCodium-1.74.0.22342.glibc2.17-x86_64.AppImage --appimage-extract-and-run This UX is so bad. I would never be able to remember all of this let alone some noob.
- anotherhue 3y agoor `podman run -V "$PWD":/mount debian /mount/myapp` if you want a really heavy fix. Packaging for nix isn't as hard as it might seem so I've found it easier just to do it the 'right' way.
- pxc 3y ago/usr/bin/env is required by POSIX, but bash's location already varies across distros and operating systems. NixOS's choices there are fundamentally correct.
- charcircuit 3y ago>/usr/bin/env is required by POSIX No, it isn't. The required directories are /, /dev, /tmp. The reqired files are /dev/null, /dev/tty, and /dev/console. https://pubs.opengroup.org/onlinepubs/9699919799/ https://pubs.opengroup.org/onlinepubs/9699919799/ chapter 10 Since shebangs have no native way to look up binaries from your PATH scripts should be including the full path to the binary from /nix in the shebang (and they should stop opening PRs asking people to switch to /usr/bin/env for them) >but bash's location already varies across distros It almost always exists in both /bin/bash and /usr/bin/bash via a symlink. >NixOS's choices there are fundamentally correct I suspect the choice has more to do with that they don't want to do the work needed to remove /usr/bin/env.
- pxc 3y agoI thought the path was fixed by POSIX but I suppose it's only fixed by convention. Its availability is definitely part of POSIX, though: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/env.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/e... And one of its main uses in practice today is to perform lookup via PATH in shebangs, since it has to do that kind of lookup to be able to launch programs with modified environments as given in those examples anyhow. It obviously can't perform that common function if applications using it can't find it, so it's in an exceptional position relative to other utilities. NixOS just makes the correct tradeoff here for `env` to be able to perform one of its main functions by putting it in a conventional location. > Since shebangs have no native way to look up binaries from your PATH scripts should be including the full path to the binary from /nix in the shebang (and they should stop opening PRs asking people to switch to /usr/bin/env for them) Nixpkgs already has facilities to handle this for scripts that are packaged via Nix. Those shebangs matter only when (a) some impurity is actually desired or (b) the scripts are used/managed out-of-band. The issue also doesn't only affect NixOS. > It almost always exists in both /bin/bash and /usr/bin/bash via a symlink. What if I don't want to use the system bash (ever) because it's old? If someone isn't shipping their own bash or targeting a specific version that they know comes with a target platform very deliberately, why should they point to the system bash?