Live data from Hacker News

Using Nix on macOS

checkoway.net

41–50 of 116 posts

Re: Using Nix on macOS

#41

Something not mentioned here is that each and every single macOS update will break your Nix install too. This is, by far, the most frustrating part of using Nix on macOS.

I was surprised recently when upgrading from Catalina to Monterey and all the nix stuff just kept working. It was the first time a major macOS hasn’t broken nix.

Does anyone know if this update was a fluke?

Re: Using Nix on macOS

#42
post #32

That seems like a hell of a lot more work than just using Home-Manager and flakes. Flakes add a lot of boilerplate, but this seems excessive in comparison. And Home-Manager is quite easy.

This blog post follows IanTheHenry's method for declarative environments via nix-env, which was produced when Ian was following a methodology for learning Nix that deliberately eschewed engagement with the Nix community in favor of relying only on the official documentation. So it doesn't use flakes or any unofficial community tools that could make setup 'easier' in the sense of being a bit more ready-made. Anyway I…

There's nothing wrong with it, but also I think it would be worth making it explicit that things are done the hard way. It's a bit like writing a programming on macos post with "so first we need to craft a xnu message by hand". For people arriving from search that's not a great impression.

Re: Using Nix on macOS

#43

Something not mentioned here is that each and every single macOS update will break your Nix install too. This is, by far, the most frustrating part of using Nix on macOS.

This hasn't been true in my experience. I've been running Nix on macOS for nearly a year without problems.

Re: Using Nix on macOS

#45
post #35

Earlier quoted context omitted.

Totally, this post is doing a disservice to Nix.

I think that's a bit unfair to the author, whose goal is clearly to document their own setup on a didactic way rather than to say > here, paste this into your terminal for the easiest way to get up and running with Nix in a fashion that's representative of community common practices I think it's a good blog post which, carefully read, teaches lots of useful things about Nix in a pretty concise way. It's totally fair…

I don't know if it should. Like this is neat and all but it's incredibly overcomplicated and for any readers unfamiliar with the tooling (which is most) it's off-putting.

If the audience was Nix users, then it would be different.

It's kinda like if you bought a fancy new camera and demonstrated your process but all your photos were out of focus, framed badly and lit poorly because you're into that for some reason. Would fellow fancy new camera enthusiasts cheer? Would folks who don't know about your fancy new camera think it's a good camera?

Re: Using Nix on macOS

#46
This is a pretty unusual set up. The title should probably be "how I use Nix on macOS".

For folks unfamiliar with Nix, this is a fairly atypical and complicated setup. It's honestly pretty smooth sailing normally.

Re: Using Nix on macOS

#47
post #17

> Usually, your terminal emulator will create a login shell by default when you open a new terminal window. (Apple Terminal and iTerm2 both do.) And that’s generally the only time you create a login shell. On a Linux system, login shells are only invoked when you actually create a new session which doesn't come from an existing session belonging to the same user. In other words, you get the when - you switch to a 're…

Wow I don't know what's crazier... that OS X still has finger or that it's had it this whole time and I never noticed. I remember fondly the early days of the internet when "finger `cat /etc/passwd`@remotehost" and other similar types of exploits had ridiculously high hit rates. And of course no shadowed password files yet.

Re: Using Nix on macOS

#48
post #17

> Usually, your terminal emulator will create a login shell by default when you open a new terminal window. (Apple Terminal and iTerm2 both do.) And that’s generally the only time you create a login shell. On a Linux system, login shells are only invoked when you actually create a new session which doesn't come from an existing session belonging to the same user. In other words, you get the when - you switch to a 're…

I think this is because launchd+getty and systemd+agetty are doing something similar in those circumstances? They're both opening pseudo-terminals with the login command. That is to say, opening Terminal.app connects to a 'network' PTS much like SSH does, afaict.

Re: Using Nix on macOS

#49
post #40

Earlier quoted context omitted.

I suppose you could , but Nix (and NixOS) defaults to keeping packages for an insane amount of time. 3 months of regular Nix use can accrue ~300gb of packages, which is definitely not what you'd have on something like Homebrew.

Does nix and NixOS ever run the GC for you? I’ve always found that I have to manually run it at a time and place of my choosing.

Check out the option 'nix.gc.automatic'. It's set to false by default.

Re: Using Nix on macOS

#50
post #24

Perhaps what is missing is the book "Nix - The good parts". Not saying Nix is not good overall, but getting a condensed description what is worth knowing, leaving out what can be ignored or is obsolete, would be quite valuable.

Here you go:

- don't use nix-env ever

- enable and use the new nix command (nix3)

- enable and use flakes

- use home-manager

- if on macOS, use nix-darwin

- with flakes, freely use nixpkgs unstable (stable is still useful, but flakes provide their own stability through pinned versions).

Post reply on HN