Comment by jonhohle
2 years ago
You might suggest she write a MacPorts Portfile(s) (or the Homebrew equivalent) that describes the her setup. It is a distraction, but hopefully a one time distraction. It doesn’t have the overhead of running docker, gives her all the tools in well-known paths. IMHO (and as a fan), MacPorts has an advantage over HomeBrew by having all dependencies vendored so OS updates have less impact.
Edit to add, if you or her want help with this, I wouldn’t mind helping, reach out to my username at gmail.
> MacPorts has an advantage over HomeBrew by having all dependencies vendored so OS updates have less impact.
I use MacPorts, but be careful stating this. libc is unstable between major releases of Mac OS, and the recommendation from the MacPorts project itself is to reinstall *all* of your ports after an OS upgrade.[1] This is not a fun process if you don't delay updating until the build bots for the latest OS go online. Also note it is literally impossible to statically link libc in Mac OS applications.[2]
Realistically speaking, I think Nix is likely to be a better alternative to both MacPorts and Homebrew for setting up dev environments, since you will have a declarative file format rather than ad-hoc Tcl (or Ruby) scripts running a function for fetch, verify, configure, build, destroot, etc. The only reason I personally don't use Nix is because MacPorts has more or less just worked for me and I haven't had the motivation to learn how Nix really works.
[1] https://trac.macports.org/wiki/Migration
[2] https://developer.apple.com/library/archive/qa/qa1118/_index...
Nix is great in theory, but the user experience is unacceptably bad, especially for anyone who isn’t a software engineer.
While it does do an excellent job of reproducibility if the inputs are the same, I’ve found it to be prone to be breaking if you switch to newer versions.
Part of the reason that it’s painful to use is because while it’s marketed as “declarative”, in actuality it’s functional, which results in a lot of convoluted syntax to modify parameters for a package, which varies based on the language of the package.
There seems to be some awareness of the usability issues, but the changes have seemed both a step forward and backwards. For instance, you used to be able to use the “nix search” command to look up package names; now it’s gated behind some arcane syntax because it’s “experimental” and something to do with flakes. And flakes seems like it has the consequence of fragmenting the package repositories and making it impractical to improve the language.
I still have helper functions to wrap desktop applications that I had to set aside, because some upstream changes broke it and neither I nor anyone on the nix forums could figure out if there was even a way to include them in the “darwin” namespace with an overlay. My goal was to make it as easy as homebrew to add an app to nix’s repository.
Another evening I sat down to make a minor feature to a Python library and decided to use a nix environment. In theory, this should have been better than a virtualenv. In practice, there’s no in-tree support for specifying specific versions of Python libraries, and mach-nix had trouble with the dependencies, so I wound up just filing a bug report and gave up on the feature I was trying to implement.
On the plus side, NixOS finally has a graphic installer, but I don’t think that helps macOS.
I’m still hopeful that the community will decide to prioritize usability, but after spending an aggregate of months of time trying to get things to work and continually running into time-consuming roadblocks, it’s not something I would recommend lightly to someone who wants to be more productive.
> Nix is great in theory, but the user experience is unacceptably bad, especially for anyone who isn’t a software engineer.
This is a pretty extravagant claim. It was once very bad but there's now a large quantity of tooling that makes it as easy to work with as Homebrew.
For managing their home, people can use Fleek, which makes Home Manager straightforward to work with: https://getfleek.dev/
17 replies →
> Part of the reason that it’s painful to use is because while it’s marketed as “declarative”, in actuality it’s functional
You're correct, with a twist: NixOS is declarative, nix is not - it's indeed functional machinery.
This exposes a declarative interface:
This does not:
but being functional makes it easier for the declarative bits to exist, e.g the next step in this case (PR pending on my side to contribute just that upstream) is:
It also makes pinning/rollback to a specific version without touching the remainder of the system a spectacular non-event:
Even when `.package` is not made available it's only slightly harder to use another module with disabledModules + import.
> Another evening I sat down to make a minor feature to a Python library and decided to use a nix environment. In theory, this should have been better than a virtualenv. In practice, there’s no in-tree support for specifying specific versions of Python libraries, and mach-nix had trouble with the dependencies
Maybe you tried too hard to "nixify" everything, including managing the whole of python stuff. That's what I use:
And then just `pip -r requirements` or whatever poetry you fancy.
On a specific project I needed a bit more control, and some fix because of a braindead build system. Fix once and be done with it.
Sure that's not pure nix or flakesy or whatever, but simply delegating python things to python-land is a very pragmatic move, idealistic purity and reproducibility of everything be damned, it is instantly better than homebrew or docker because that setup gets you a consistent tooling environment on any Darwin (Intel or ARM, at whatever version) or Linux (whether it's NixOS or just nixpkgs).
Also it's super amenable to collaborators who don't know the first thing about nix: they can blindly type `nix-shell` and be all the merrier, handling their python stuff as usual, and completely removing a whole class of "it works/breaks on my machine".
> libc is unstable between major releases of Mac OS
Really? I thought Golang on macOS switched from direct syscalls to linking against libc, because the former is unstable but the latter is stable.
I’d like to see a source for that too. If libc broke its ABI between OS releases there would be chaos.
> This is not a fun process if you don't delay updating until the build bots for the latest OS go online
The Sonoma installer came out for MacPorts less than a week after the release IIRC. The migration is like 4-5 shell commands. One of them takes a while as everything recompiles but it’s not interactive.
Agreed. I switched from Homebrew to MacPorts a few years ago and couldn't be happier. I just delay upgrading macOS until MacPorts officially supports the latest OS (which often takes a bit longer than Homebrew).
NOTE: I briefly tried Gentoo Prefix, so I could use the same setup for both Linux and macOS, but that required quite a bit more time investment than I'm willing to deal with. I spent even less time trying out Nix, but the learning curve was steeper than I had the time for, so I gave up on it pretty quickly.
Cheers to this guy.
> dependencies vendored
did you mean versioned? if you really meant vendored, could you elaborate?
I don't know about brew, but MacPorts wasn't ready when Sonoma came out. So that's a bit of a bummer for early adopter types, or folks that need to develop their own app against beta macOS and depend on ports for their setup.
Vendoring means to bundle dependencies into a project directly (often this means copying source code and using/maintaining the copy) rather than from some other source (other packages, OS, package repo, etc). Here's an article from LWN that talks about it with a real world example: https://lwn.net/Articles/842319/
Early adopters can upgrade MacPorts before it officially supports the latest OS by building from source if they have the patience and are willing to debug any broken ports.
Isn't that the point of using a package manager to avoid the compiling from source and manually handling the dependency tree? Seems the better advice would be to wait for MacPorts is ready before upgrading if the software from it is that critical
4 replies →
vendored just means copying the upstream code dependencies into your project.
Golang, where it is (or used to be) a common practice, even has special tooling for this, and dedicates the "vendor" directory to that.