Live data from Hacker News

Using Nix on macOS

checkoway.net

101–110 of 116 posts

Re: Using Nix on macOS

#101
post #91

I'm actually trying out Nix on a fresh Mac install since this week, but I'm not yet sure if I enjoy it. When things work it feels pretty great, documentation feels lacking though so when I want to do something I haven't done yet I generally try to find examples of something similar. I do think I'm beginning to understand the language better that reading the source nix files almost become the docs for me. The main pro…

> Luckily I can just download a binary watchexec build to get around it but it would be nice to know how to get it working. Using steam-run, nix-autobahn or using buildFHSUserEnv yourself.

Those solutions won't work on macOS, though.

Re: Using Nix on macOS

#102
post #53

I have tried using nix for weeks on macOS and it’s been a really painful experience. I’ve pretty much given up. I don’t think they care much about user experience tbh.

Did you use an approach like the blog or one with nix-darwin, home-manager, and flakes?

Not trying to convince you to try again since you seem done, but want any prospective nix users to know which approach you found painful.

And if you don't mind, a list of the most painful things that should be improved.

Re: Using Nix on macOS

#103
post #23

Earlier quoted context omitted.

I’m not kidding! I hacked together a bunch of env vars, carefully ordered tar unpacking, and some chrooting for dev envs at Airbnb years ago. It’s effective.

Before docker was invented, I worked on chroot based dev environments at work too (linux host), and I loved it. But I’ve never really touched Mac OS. Does Mac OS natively support this style of development? Do you know of anyone that’s blogging about it?

It doesn’t. My hope was if Apple and Microsoft provided this feature, we could build a common foundation on top.

Re: Using Nix on macOS

#104
post #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.

Yeah but I wonder why. (Invoking `login` at the CLI in Terminal.app yields the same result as opening a new tab on macOS.) Trying the same on Linux says you have to be root, and does not log you in.

Anyone got a Linux distro configured differently that they can explain, or a *BSD they care to try and compare on? Is there any reason (security, 'correctness') to prefer one way over the other?

Re: Using Nix on macOS

#105
post #86
post #84

hi, nix on macos user dropping in to deliver a PSA for the non-nixer macos users amongst you reading this article: * you are correct to be terrified * you are correct to think “this is a demented amount of busywork; who in their right mind would do this to themselves?” * you should know that this is a highly atypical setup that does a staggering number of things by hand for no discernible reason * normal people just…

Do you have a more real world example of a darwin-configuration.nix? I want to see how this looks like and maybe hear about experiences with it longer term.

i would just link you mine but this is a pseudonymous account; however:

most nix-darwin users i know have a darwin-configuration.nix that's nearly identical to the one the installer plops down for you, with the exception of more items under `environment.systemPackages`, and using nix-darwin solely as a declarative alternative to nix-env is totally viable

other than a few built-in service configurations and plist defaults, darwin-configuration.nix typically grows much as configuration.nix does on nixos. define or modify a couple packages here and there, shove them into `pkgs` by setting `nixpkgs.overlays`, etc etc. the ux is intentionally very similar to that of nixos

what this means is you can look at a lot of people's nixos config repos and get some idea of what you can do just as well with nix-darwin

i can, however, offer you my anecdote:

nix-darwin has let me completely forget that brew and macports exist, and even let me get away without installing xcode at all -- it's perfectly competent at “getting a suite of dev tools onto a macbook”, but what really sold me on it was just how straightforward adding a new package is:

  mypkgs $ bc 
that's an average of 32 lines to go from “obscure thing that literally nobody packages” to “bona fide part of my system”, and that includes meta blocks with homepage/description/etc, because i periodically try and get some of this stuff merged into mainline nixpkgs

the language itself is a little quirky and the evaluation model of the module system is somewhat fraught with fixed-point knot-tying fuckery, but between the process of packaging being so nice and brew/macports pissing me off, i found it easy to drink enough koolaid to get to grips with those aspects

i've been using nix-darwin and for almost exactly one year, and replaced all my linux installs with nixos, and i have not looked back whatsoever

Re: Using Nix on macOS

#106
post #85
post #79

Earlier quoted context omitted.

I switched to Nix because, unlike Homebrew, it does not include silent Google spyware.

Homebrew includes Google Spyware? Do you have a source? That's a huge opsec issue.

Homebrew puts a unique identifier on your system that phones home to Google with your unchanging unique ID and IP address every time you install a package.

Because client IP is coarse geolocation, this unique tracking ID allows Google to see your travel history.

Re: Using Nix on macOS

#107
post #7

Christ that's a lot of work, just to start working on work. I really want to like Nix, but the UX is frankly offputting. I really hope it improves to the point that it can be mindlessly installed.

I wouldn’t take this one blog post as gospel about how to use Nix. I’m not denying that it’s complicated, but doing declarative package management is not the only way to dip your toes into Nix. You can use it pretty much as a conventional package manager with none of the upsides of declarative package management (but none of the complexity either). On the surface level for people migrating from existing package manag…

So what’s the simplest way to start using nix on macOS?

Again, I am convinced Nix is a superior way to write software, and I would love nothing more than to have a working installation in a few minutes.

Re: Using Nix on macOS

#108
post #77
post #57

Earlier quoted context omitted.

People say that but yet nobody linked to a post explaining the “right way” of using nix on macOS

Here is the official manual page for Basic Package Management. No blog post necessary. This covers the majority of it, but I’d say if you read the entire section on Package Management, then you’ll get an idea of how it works and be able to install, update and uninstall things (as well as a bit more). https://nixos.org/manual/nix/stable/package-management/basic... Also, there is no “right way”. What I suggested was th…

This doesn’t tell us how to install it, which is what we’re griping about.

Re: Using Nix on macOS

#109

Earlier quoted context omitted.

Before docker was invented, I worked on chroot based dev environments at work too (linux host), and I loved it. But I’ve never really touched Mac OS. Does Mac OS natively support this style of development? Do you know of anyone that’s blogging about it?

It doesn’t. My hope was if Apple and Microsoft provided this feature, we could build a common foundation on top.

I'm wrong, turns out, chroot works on the Mac after all.

Nice, that's a first step. I'll try to play with the idea

Re: Using Nix on macOS

#110
post #77

Earlier quoted context omitted.

Here is the official manual page for Basic Package Management. No blog post necessary. This covers the majority of it, but I’d say if you read the entire section on Package Management, then you’ll get an idea of how it works and be able to install, update and uninstall things (as well as a bit more). https://nixos.org/manual/nix/stable/package-management/basic... Also, there is no “right way”. What I suggested was th…

This doesn’t tell us how to install it, which is what we’re griping about.

https://nixos.org/manual/nix/stable/installation/installing-...

This worked for me. I think MacOS installation was a bit hands on due to Mac weirdness (when I did it ~2 years ago), but I think it is better now.

Post reply on HN