15 ms·
IMHO the original choice of the path seems incredibly ill-advised and the main burden lies with the original developers. sometimes old errors and mistakes come
by glofish 6y ago
IMHO the original choice of the path seems incredibly ill-advised and the main burden lies with the original developers.
sometimes old errors and mistakes come back and bite
- soraminazuki 6y agoIt only seems that way now because some platforms have begun locking down their root directories. Nix, by design, doesn't conform to the FHS way of organizing directories so it made perfect sense to use /nix when the decision was originally made.
- zozbot234 6y ago> Nix, by design, doesn't conform to the FHS way of organizing directories 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").
- soraminazuki 6y agoNix isn't designed as an application. It's designed as a system package manager.
- californical 6y agoIt's also an application, it just happens to manage other applications
- soraminazuki 6y agoTo be more clear, it wasn't designed as a third-party package manager. It's supposed to be part of the system.
- sneak 6y agoOr NIX_PATH, or ~/.nix, et c. 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.
- jeremyjh 6y agoYou can use an alternate path with Nix. When you choose to do that, you will have to build all packages from source instead of installing prebuilt binaries.
- sneak 6y agoThat makes sense, and is good news. I withdraw my complaint against Nix; in my defense my ignorance was based on the thread on their GitHub about how Catalina makes Nix basically unusable. Turns out those people were both a) wrong and b) speaking authoritatively from ignorance. :/ I’m quite glad I can just install it somewhere else, and finally ditch the Homebrew spyware. Thank you for letting me know!
- danudey 6y ago> Nix, by design, doesn't conform to the FHS way of organizing directories so it made perfect sense to use /nix when the decision was originally made. 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.
- matheusmoreira 6y ago> creating arbitrary directories in / is a terrible idea, and has been at least since I started using UNIX/Linux systems in the 90's Why?
- cesarb 6y agoBecause the root directory might be on a very small partition (perhaps only a few hundred megabytes), while other mount points like /usr might have more space; the only things which should be in / are the things which are necessary to mount the other filesystems (perhaps through the network using NFS). (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...)
- chungy 6y agoEasy solution: /nix as its own partition with plenty of space.
- mixedCase 6y agoBecause the filesystem root is the domain of the OS, if tomorrow they decide they are going to create a symlink of /dev/null in /nix because they thought it sounded cooler as a way to "nix" stuff, there goes the Nix package manager. The OS gives you places to put your files, use them so that you prevent breakage. We have the FHS, so you even have some degree of certainty of where to do it across Unixes. EDIT: Two downvoted comments answering a "why" but no rebuttal to either. HN is slowly but surely becoming Reddit.
- adamtulinius 6y agoWhat should the default nix store path have been then?
- hunterloftis 6y agoIn my very limited (I don't use nix) opinion, the default of /nix isn't an issue, but rather: > 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.
- soraminazuki 6y agoUnfortunately, what you're asking for is fundamentally impossible with binary package managers.
- danudey 6y agoThe obvious option would be /opt/nix, /usr/local/nix, or something to that effect. /nix is a clearly obviously bad choice, and now we're starting to see why.
- Spivak 6y agoThe problem is that /opt/nix isn’t safe from the OS and Nix is explicitly software that doesn’t follow the FHS so it makes no sense to install it in a prefix. /opt/local/nix is probably safe.
- blunte 6y ago/usr/local/something
- Spivak 6y ago/usr/local is a prefix and contains local software that follows the FHS (i.e. libs in lib/, docs in doc/ binaries in bin/). Nix explicitly doesn’t do that so it would be inappropriate to install it there.
- danudey 6y agoI second this. Any tool which creates its own directory in the filesystem root (and cannot run from any other location) is inherently doing it wrong by any measure.
- pmarreck 6y agoThat's not necessarily true because it ensures that you own an entire namespace separate from the OS install, which in Nix's case makes a lot of design sense given its use case(s).
- soraminazuki 6y agoBy your own words, tool like apt, yum, and pacman would all be "doing it wrong." It's just wrong to blindly apply any rules without considering the various presumptions that justifies it. Specifically, the general advice of not creating directories in the filesystem root mainly applies to individual packages and is inadequate for system-level package managers.
- eximius 6y agoWhat is special about /nix that would make it better suited elsewhere? Aesthetic? Clutter? I don't think there are any technical reasons why the root of the filesystem is important. The /nix folder is just another folder with some ACLs/Permissions (however OSX works, idk)
- prewett 6y agoHistorically / has been reserved for the use of the Unix system (the distribution that packaged it, not the computer you're running on). Local programs were installed to /usr/local. Packages installing themselves in /packagename are making your root directory like Windows' Start Menu. Furthermore, if your, say, Physics department has 20 machines, your sysadmin would install everything on an NFS share, which probably got mounted at /opt. Your sysadmin definitely did not want to mount /this, /that, /theother. So while /nix is no problem from the filesystem driver, it is completely flaunting established Unix norms.
- Spivak 6y agoEverything not specified in the FHS is reserved for use by the administrator. The FHS isn’t all-encompassing. It’s a contract about what directories the OS wont touch. 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.
- eximius 6y agoYou're not _wrong_, but I'm not sure that those reasons really mean anything. They were all new and arbitrary at some point and we're a long way from Unix. > 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.
- kempbellt 6y agoIf you truly want to be "cross-platform" with long-term future proofing in mind, `/nix` is (edit: was) probably the most stable choice. 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`?
- catalogia 6y agoIf you have to `mkdir /nix`, what's wrong with `mkdir -p /opt/nix`? I don't see how one is "more stable" than the other. The big difference between the two is the later conforms to convention while the former doesn't.
- kempbellt 6y ago`mkdir -p /opt/nix` assumes that there is a convention, and that this is the correct convention - which may not be the case for every situation, and would result in creating unnecessary nested directories. 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.
- catalogia 6y ago> `mkdir -p /opt/nix` assumes that there is a convention 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.
- FullyFunctional 6y agoWhy are you apologizing for Apple? I too have always had my own path in / (/u for my NFS mounted homes). I guess I just learned of yet another reason I will never go to Catalina (or buy any more macOS hardware).