8 ms·
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
by dcchambers 4y ago
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 https://github.com/mitchellh/nixos-config
Honestly, doing that may be easier and a better option than using Nix packages in MacOS.
- gurjeet 4y ago> 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 edges.
- smoldesu 4y agoNix is one of those rocket-powered chainsaw tools that you run into, and while it still scares me (and I often worry about accidentally cutting off a limb), it's much nicer to use than Homebrew. The only caviat is that your Nix store can get enormously huge, which is a big problem on Apple devices where storage comes at a premium.
- yjftsjthsd-h 4y agoI would naively expect that if you run garbage collection on a regular basis that it should take no more space. Is that not true, or is running it on a regular basis the sticking bit?
- smoldesu 4y agoI 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.
- pxc 4y agoBy default don't they keep old generations (and thus previously-installed packages) literally forever?
- quag 4y agoDoes 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.
- VTimofeenko 4y agoCheck out the option 'nix.gc.automatic'. It's set to false by default.
- phantomathkg 4y agoCan't you just run nix-collect-garbage?
- rgoulter 4y ago> 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, that's simple to use, and already get their job done with other package managers. -- I think for this group, Nix is going to be a bad tool to recommend, even if they keep hearing about how neat Nix is. Rather. Nix is wonderful 95% of the time. But the 5% of the time you run into some problem, it's much more difficult to get unstuck compared to other tools. (Other knowledge is necessary but not sufficient, the community is small so maybe harder to find a StackOverflow post, the documentation is fragmented, etc.).
- vasergen 4y agoI 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.
- rgoulter 4y ago> 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 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.
- dunham 4y agoYeah, 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 tricky to use things like libraries outside of nix's build process. And there is a bit of an impedance mismatch when trying to use languages that have their own package management. So I've got nix for a bunch of software, a couple of libraries in homebrew, and native package management for various languages (cargo, ghcup, lake, idris). I also reluctantly installed agda via homebrew because I can't get it to build. (Haskell mostly works on M1).
- tempodox 4y agoMacPorts is a better alternative to Homebrew, I never had any problems with it.
- spockz 4y agoThe only time things break for me because something is replaced by homebrew is because c/c++ projects seem to so overly rely on dependencies (headers, .a files, etc.) being installed by the os globally. Maybe this is better when the project uses Bazel instead of make/(auto)configure.
- sneak 4y agoI switched to Nix because, unlike Homebrew, it does not include silent Google spyware.
- month13 4y agoI recently had tried to use Nix again after a hiatus. I wished to use Nix to replace Homebrew, but also for managing versions, of like Ruby or dotnet. Sadly, it's not quite there for my needs, but it's getting better. Flakes are more fleshed out, the CLI is improving in it's user experience. I still don't feel like I understand the language works and build my flakes off of copying/pasting the one that works.
- greymalik 4y ago> I’ve cutdown my dependence on homebrew almost to the point of its absence What are the advantages of that?
- gurjeet 4y agoI use Nix for the advantages it provides, and use other package managers (homebrew, etc.) for things that are not available in nixpkgs.
- mistahchris 4y agoFor all of my personal machines, I use NixOS (both hardware and in cloud machines). But for work, we have a soft-MacOS mandate. On that m1 macbook pro, I run nix-darwin for the mac specific settings I want, and packages that I run in macos, but everything else in a NixOS VM similar to mitchellh/nixos-config. I use UTM (a nice wrapper around qemu), but the rest is just standard nix config, of which, nearly all of it I reuse from the configuration for the rest of my machines.
- unzadunza 4y agoThanks for pointing out mitchellh/nixos-config. Do you have a config published for nixos with UTM? I’m having a heck of a time getting the screen resolution and font sizes where I want them and I’m kind of lost.
- mistahchris 4y agoYep. Note that there's nothing you need to do to configure display resolution in UTM / qemu. You do need the spice guest tools installed in your nixos vm though. The only thing you should need to do is set the resolution in whatever display manager you use in nixos. For me, I run the sway window manager. My display manager is kanshi. Here's my config: https://git.sr.ht/~averagechris/dotfiles https://git.sr.ht/~averagechris/dotfiles Here's a branch that I has some aarch64 specific things in it that I'm using for my guest vm config (I will merge it into the main branch when I get an hour or two so this link might die at some point) https://git.sr.ht/~averagechris/dotfiles/tree/aarch64-work-vm/ https://git.sr.ht/~averagechris/dotfiles/tree/aarch64-work-v... Here's the link to my display manager config https://git.sr.ht/~averagechris/dotfiles/tree/aarch64-work-vm/item/nixpkgs/sway/kanshi.nix https://git.sr.ht/~averagechris/dotfiles/tree/aarch64-work-v...
- ParetoOptimal 4y ago> I’m having a heck of a time getting the screen resolution and font sizes where I want them and I’m kind of lost. services.xserver.videoDrivers = [ "qxl" ]; services.spice-vdagentd.enable = true;
- xyzzy_plugh 4y agoNix on MacOS is fine. I've actually experienced less stability running VMs and Docker than I have with Nix on MacOS. nix-darwin is the missing piece of the puzzle, providing NixOS-like functionality. NixOS is pretty great too, but there's no need to run a VM to use it. NixOS generally solves OS problems. Adding a VM just adds complexity.
- pxc 4y agoSeconding the rec of Nix-Darwin! Great way to use Nix declaratively on macOS, not just for managing packages but also services like on NixOS.