by soraminazuki · 6y ago · 0 comments
As of Catalina, there's no sane way to install the Nix package manager without losing functionality because macOS now disallows creating new files in the root directory[1]. Nix stores its packages in the /nix directory and it's not possible to migrate without causing major disruptions for existing NixOS and other Linux users. This is too bad, since apart from Nix being a nice package manager, it also provides a sane binary package for Emacs. The Homebrew core/cask versions only provides a limited feature set[2][3].
[1]: https://github.com/NixOS/nix/issues/2925
[2]: https://github.com/Homebrew/homebrew-core/issues/31510
[3]: https://github.com/caldwell/build-emacs/search?q=support+is%...
Ha, no. They did the absolute worst thing they could have done and now that they are popular they think they "own" /usr/local. (They used to camp out in /usr, but Apple rightfully put a stop to that real quick when SIP came out.)
That predefined path being the same (/nix) across all users of nixpkgs is required to be able to share binary packages (you could perhaps build everything from source, but that's a lot of time, more time even than something like gentoo because package updates require all dependencies to be rebuilt as well).
You can call it an insane choice or bad design, but there aren't a whole lot of options here. Could Nix move to a different path? Maybe, but is there a path that all operating systems could abide? If the new path stops working in some future OS, will it still be insane and bad design? Again, maybe, but I happen to love Nix and I use is on macos because it makes my life easier (and I'm on macos for work reasons). I'm willing to bend and do a lot of legwork to be able use Nix, and I'm upset with the Catalina situation.
Can follow some discussion here https://github.com/NixOS/nix/issues/2925
Going with /nix was basically the best way to run into trouble.
How so? Taking over /usr/local as Homebrew does is guaranteed to cause conflict. Using a dedicated file hierarchy as Nix does is quite reasonable and there's nothing magical about rooting it at /.
Because it shoves all its shit there without asking.
Macports actually did it correctly and IME never had any issue.
While locking all needed versions for a specific application provides stability, I can't believe it doesn't come without a large increase of complexity, especially in connection security upgrades which triggers other libraries to need an update as well.
That's a hilarious assertion. Back in the days brew's takeover of /usr/local caused OSX upgrades to get stuck for hours on end (some folks reported more than 12h).
This is completely false. You can change the installation directory at the cost of losing binary packages. When you change it, packages would be built from source instead. This is what Homebrew does too.
What's more, I don't think many package managers provide this option. Not apt, not yum.
https://github.com/cormiertyshawn895/Retroactive
Got some discussion on HN [1] about 3 months ago amongst other places, cool bit of sleuthing in the vein of efforts to get versions of macOS running on Macs older than officially supported. Personally I'm somewhat resigned to needing VMs to run certain older software, with a big one for me being Creative Suite CS6. Like you I have no interesting in buying into Adobe's subscription lock-in. But it's nice that some stuff can keep running without that layer for a while longer. Hopefully it'll still be possible in 10.16.
----
https://github.com/cormiertyshawn895/Retroactive
It also works for iTunes and iPhoto. Sadly it won't fix any of the other known Catalina issues, of course! ;)
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.
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?
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.
I really wish Apple would give third parties the ability to create firmlinks (or at least give Nix one), or barring that, give us a sane way to mount encrypted volumes at the same time that the system volume is unlocked.
This comment has worked for me on two machines: https://github.com/NixOS/nix/issues/2925#issuecomment-539570...
1. You have to create a separate volume just to install a package manager, which is a poor user experience
2. A separate volume means FileVault won't work out of the box
3. The volume can be mounted only after GUI apps are brought up
4. Restoring after sleep might fail because of 3
All of these are mentioned in the Github issue, but it might be hard to find because it requires so many clicks and scrolling to view the whole thread.
2 — Could you explain? Mine is on and working, I didn't need to do anything else.
3 — Is this if you have login items that need nix to be available? I don't have this so I haven't noticed.
4 — I've never run into this, but again I might just not use Nix for the kind of things that would cause issues.
1. Having to create a volume when a plain old directory should suffice is insane. It's creating a hassle for no good reason for users.
2. /nix would be unencrypted by default if kept in a separate volume. There's also the problem of how to unlock it upon boot.
3. Login items is a very common use case so not supporting it would be problematic for many users.
4. Unreliable sleep is an even bigger problem.