Live data from Hacker News

Using Nix on macOS

checkoway.net

81–90 of 116 posts

Re: Using Nix on macOS

#81
post #15

Earlier quoted context omitted.

> Honestly, doing that may be easier and a better option than using Nix packages in MacOS. Respectfully, I disagree. I’ve been using Nix on a couple of my Macs, including on an M1, and I’ve cutdown my dependence on homebrew almost to the point of its absence; I rely more on Nix packages, than on Homebrew packages. Having said that, I still wouldn’t recommend anyone using Nix; steep learning curve, and too many rough…

> I still wouldn’t recommend anyone using Nix; steep learning curve, and too many rough edges. I'd like to think there are roughly two camps of people: Those who hear about Nix's declarative nature, with its reproducible/'pure' nature, and generational installation, all of which allow for some pretty neat UX. To this group, Nix sounds technically interesting. The other group, those who want a tool that just works, th…

I have exactly same problem using Nix package manager in Ubuntu. That's why for those other 5% you can usr usehomebrew or whatever other package manager you have in your system.

I am not sure what is the story of having NixOS as a server, but would not suggest to have it as a main OS. There a sometime cases when there are simply no package you want to install, or you install it but some functionality doesn't work. Yes, maybe one can fix/patch, but I simply fall back to apt-get in such cases, and don't spend my time on that. Usually I have problems like this with GUI application, ie: installed pdf editor, which can open pdf, but can highliting functionality doesn't work and the crashes.

Re: Using Nix on macOS

#82
post #23

Earlier quoted context omitted.

Yeah, you kid, but you know, it would solve a lot of the most common problems. Like a parent mentioned, most of the time you're just not linking to the right libraries. That’s it. Do we need to ship a whole kernel, have terrible IO and jump through a lot of hoops just for that?

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?

Re: Using Nix on macOS

#83

Earlier quoted context omitted.

> I still wouldn’t recommend anyone using Nix; steep learning curve, and too many rough edges. I'd like to think there are roughly two camps of people: Those who hear about Nix's declarative nature, with its reproducible/'pure' nature, and generational installation, all of which allow for some pretty neat UX. To this group, Nix sounds technically interesting. The other group, those who want a tool that just works, th…

I have exactly same problem using Nix package manager in Ubuntu. That's why for those other 5% you can usr usehomebrew or whatever other package manager you have in your system. I am not sure what is the story of having NixOS as a server, but would not suggest to have it as a main OS. There a sometime cases when there are simply no package you want to install, or you install it but some functionality doesn't work. Ye…

> I am not sure what is the story of having NixOS as a server, but would not suggest to have it as a main OS

This was what I thought when I was learning nix. Once I used NixOS, I realised it's not quite that difficult. -- The two big differences: 1. Roughly, you only really need to care about the NixOS config about as frequently as you'd change system files in /etc/ in other Linux distributions. 2. Some programs (e.g. minikube) will download a binary automatically, and this doesn't work well with NixOS.

I've seen tools like distrobox https://github.com/89luca89/distrobox recommended as backups on NixOS, as well as the usual Docker / VMs.

I secretly suspect some of the reason NixOS is popular is it's less trouble than nix on non-NixOS. Whereas, nix on macOS, I've sometimes mixed compilers/libraries, which leads to difficult to discern problems.

Re: Using Nix on macOS

#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 install https://github.com/LnL7/nix-darwin on top of standard nix and enjoy about the same lack of janitorial work as macports/homebrew users, relative to whatever the hell this guy is doing

* please don't be scared off nix by this article

Re: Using Nix on macOS

#85
post #79
post #56

Earlier quoted context omitted.

Yeah, I switched completely to nix after being frustrated with homebrew constantly breaking things (any time I installed something. (Usually involving libicu being replaced with a different version.) And then had to pick up homebrew again for a couple of things. I _really_ like being able to drop into a shell with a few additional packages installed. But nix does have a learning curve and some rough edges. I found it…

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.

Re: Using Nix on macOS

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

Re: Using Nix on macOS

#87
post #63

Earlier quoted context omitted.

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).

And you do this to install MySQL?

That argument can be weaponized against anything and everything, really.

"Oh, Ubuntu is too complicated"

"It's easy. 1. Don't use dpkg, ever. 2. Use the apt command. 3. Avoid Snaps. 4. Well, forget about locking dependencies, this isn't Nix. 5. No Home Manager equivalent exists, so I don't know, use Ansible? 6. If on macOS, you're out of luck. 7. Make sure to download the latest release."

"And you do this to install MySQL?"

Re: Using Nix on macOS

#88

I hope Docker is not the final answer to reproducible and isolated processes because it’s a bit too complex and slow on anything other than Linux, IMO. Linux virtualization almost became a mandatory feature of a modern OS because of it. I wish there was something that would run on any POSIX, but that’s probably not enough ground to cover complete reproduction.

I don't think Docker is particularly reproducible. It has less understanding of dependencies than a Makefile. Not only does the cache rarely save build time, it is also very unlikely that two developers running the same Dockerfile end up with the same bytes in their generated image. (The classic example is "FROM ubuntu:latest; RUN apt-get update && apt upgrade". No clue what's going to be in that image, it's different every time. You can pick a particular well-known build of the Linux base, but there is no lockfile that controls what apt upgrade is going to do. Even if you avoid that, esoterica like build tools that put the current time into binaries will bite you. Other build systems have a sandbox that lets you fake those tools out, so if your control file says the build time is 10 PM on Friday, then the next time you build it it's also 10 PM on Friday.)

Docker also conflates too many concepts; layer generation, image distribution based on layers, registries and tags (mutable! wtf?), cgroups, PID namespaces, network namespaces, storage namespaces, etc. I'm sure it was a godsend for a certain type of workflow (one that depends heavily on the OS base; shelling out to utilities, using programming languages with poor dependency management systems, etc.) but for the average modern codebase, it seems like a detriment to me. I see people doing full builds of their app every time they want to test a change (often downloading 100s of packages from the Internet), simply because that's how Docker does things, and that honestly isn't right. They're throwing their time away for no good reason.

Re: Using Nix on macOS

#89
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.

They are referring to https://github.com/Homebrew/brew/blob/master/docs/Analytics....

Re: Using Nix on macOS

#90
post #15

This post focused solely on the Nix package manager and Nix packages - for anyone that uses MacOS but is interesting in trying NixOS (or using it within a VM in MacOS), I definitely recommend Mitchell Hashimoto's NixOS repo: https://github.com/mitchellh/nixos-config Honestly, doing that may be easier and a better option than using Nix packages in MacOS.

> Honestly, doing that may be easier and a better option than using Nix packages in MacOS. Respectfully, I disagree. I’ve been using Nix on a couple of my Macs, including on an M1, and I’ve cutdown my dependence on homebrew almost to the point of its absence; I rely more on Nix packages, than on Homebrew packages. Having said that, I still wouldn’t recommend anyone using Nix; steep learning curve, and too many rough…

> I’ve cutdown my dependence on homebrew almost to the point of its absence

What are the advantages of that?

Post reply on HN