by glofish · 6y ago · 0 comments
sometimes old errors and mistakes come back and bite
I get it, people are sensitive about the root directory. "But it's where ALL the stuff lives!". So yeah, try not to ever run 'rm -rf /' (even though this is blocked in most cases now).
But why make it completely inaccessible for creating files/directories in? So much hand-holding for people to make it impossible for a user to ever make a mistake just locks down the ecosystem more, forcing developers to implement proprietary hacks that don't scale properly.
`/var/opt/nix` and `/opt/nix` are options, sure. But you cannot guarantee that those directories will exist on every platform. And if you have to create them, why is this better than `/nix`?
You could make a more sophisticated installation script that attempts to install Nix into conventional locations depending on the specific operating system - or user input - but if you want a simple catch-all, simple installation script `/nix` was a perfect cross-platform installation location, until now.
A correct assumption on virtually all relevant extant systems...
> which may not be the case for every situation
In the supposed scenario where the assumption isn't correct, the downside of /opt/nix vs /nix is basically insignificant. What's the overhead of one level of directory nesting, a single extra inode? Big whoop.
That's why /opt/ exists. What's wrong with /opt/nix/ ? Or /var/opt/nix/ for read-write files that need not be a fixed part of any package installation (the Unix equivalent of system-wide "Application Data").
I am infinitely tired of this node_modules “we know better than you, it isn’t configurable and will never be configurable so stop asking” hubris. It’s not open source entitlement to say that a maintainer with that attitude is bad and wrong.
My homebrew is installed to ~/Library/Homebrew and while they claim it’s unsupported, it works, and if it stops working, then I’ll stop using Homebrew.
I don’t trust software that demands root when it doesn’t need it.
Refusing to conform to the FHS doesn't mean their decision made sense; refusing to conform to the FHS means they made a bad decision in the past and everything progressed from there.
It doesn't 'seem that way now because some platforms have begun locking down their root directories'; it seems that way because creating arbitrary directories in / is a terrible idea, and has been at least since I started using UNIX/Linux systems in the 90's.
Fact is, they made a bad design choice, and now it's come back to bite them (and their users) in the ass.
Why?
(Yes, nowadays hard disks are much larger, we have things like initrd, and we now make /bin and /sbin symlinks to within /usr, but the parent comment did mention the 90s...)
So while /nix is no problem from the filesystem driver, it is completely flaunting established Unix norms.
Generally you’re right and if you make a piece of software not follow the FHS you better have good reason. Nix, I think, makes a solid case since existing outside of the FHS is the only safe way to not conflict with every package manager.
> it is completely flaunting established Unix norms.
Also, _nix_ is completely flaunting established Unix norms in more ways than one. /nix is where all of the nix stores go, the immutable bundles that get pieced together to form all of the stuff you install. It could go in /var/nix or wherever, it doesn't really matter.
But putting it in /nix is kind of nice in that it's so different from the purposes of the rest of the filesystem. /nix doesn't behave like the rest of a normal Linux system, so it is separate. You can still symlink from /usr/local/bin/foo -> /nix/store/abcdef-1.1.0/bin/foo so the rest of your system has the same expectations.
> and it's not possible to migrate without causing major disruptions for existing NixOS and other Linux users.
Software that can't be re-parented without breaking is destined to create problems for users... eventually.
"The root directory is untouchable" is a new fear-based imperative that would have been hard to predict.
/opt/local/nix is probably safe.