3 ms·
I use NixOS as my daily driver on my two workstations, and package manager on my Mabook Pro now. It's super helpful if you have an extra computer you can refor
by SkyMarshal 4y ago
I use NixOS as my daily driver on my two workstations, and package manager on my Mabook Pro now.
It's super helpful if you have an extra computer you can reformat and spend a couple months experimenting with NixOS on, learning it, getting it set up just right, and verifying it can do everything you need your main OS to. Nix is great for this kind of rapid experimental iteration with system config, since if something doesn't work you either quickly fix it and make a new build, or just roll back to the prior working build.
The beauty of Nix is, if that succeeds, the declarative config can instantly apply it to your other computer/s too, and fully transition with minimal risk. Then you can use multiple Nix computers in a sort of A-B testing setup, where you test new config options on one till they work, and copy them over to the others only after you're certain they're ready. Repeat.
And if the initial experiment with it doesn't work out for any reason, you still have your non-Nix computer chugging along doing all the things you need it to do.
- amelius 4y agoYes, but if it doesn't work there's an indirection between you and the actual problem. Which feels like having to use chopsticks to build a Lego project.
- SkyMarshal 4y agoHow do you mean? I ran into a number of problems back when learning NixOS, but the error messages were usually sufficient to track them down.
- pxc 4y agoIt's possible on NixOS to feel like you are struggling with a problem that you already know how to solve, dammit! This frustration hits harder earlier on in one's Nix journey, imo, when your first instinct may be to just edit that dang config file under /etc. As you progress, though, the 'layer of indirection' phenomenon almost reverses, as the Nixpkgs repository becomes a quick and reliable resource you can use to learn about how to configure and manage software that you didn't already know all that well.
- ochoseis 4y agoAgree, once you realize how to traverse search.nixos.org and module definitions in nixpkgs it gets a lot easier.
- ParetoOptimal 4y ago> just edit that dang config file under /etc. Using syncthing as an example do search here instead first: https://search.nixos.org/options?channel=22.11&from=0&size=50&sort=relevance&type=packages&query=services.syncthing https://search.nixos.org/options?channel=22.11&from=0&size=5... Or say you are using home-manager for something like neovim, use this options search: https://mipmip.github.io/home-manager-option-search/ https://mipmip.github.io/home-manager-option-search/ and search "programs.neovim".
- pxc 4y agoYep! The first habit one builds with NixOS is first searching the module systems to examine existing support. And these days, the module systems are so extensive that the result is almost always a pleasant surprise. :)
- fnordpiglet 4y agoI’m curious about nix in macOS. I’ll Kagi / chatgpt it in a bit, I’m sick of brew. But was hoping to hear your experiences as well (assuming you’re not a generative AI). I run a nixos home server so am familiar, just not with using it for macOS.
- pxc 4y agoNix support on macOS is pretty good, but it's not the main OS of most Nixpkgs contributors and that does show in some ways, and there are some differences in using it as a 'guest' package manager rather than having it run the whole show. First, the bad: Apple does minorly break things on every OS upgrade by nuking all of your systemwide shell RC files, besides the more substantial. (There's been some investigation into more robust ways to get that integration working, but so far none of the leads are very promising.) Nix on macOS has to do some weird stuff to achieve integration due to macOS' security features like SIP and non-writable /. Nowadays the installer just takes care of this. macOS GUI apps don't get built by Hydra, so they're not in the binary cache. This is because they require proprietary software (Xcode) to build, and Hydra doesn't build or cache non-free derivations as a legal precaution. For grabbing things like iTerm or whatever, you might prefer using Homebrew in a limited way ('casks' only) with a non-standard prefix. This is what I have done and recommend doing. (That said, macOS GUI apps do exist in Nixpkgs and they build just fine, so if you want you can still use Nix for your iTerm and your custom Emacs build and whatever.) Now the good parts: Package availability on macOS is still great. Nix feels really fast compared to Homebrew! There's a new, alternative Nix installer available from a credible company in the Nix community that seems to cope a bit better with macOS' integration quirks, making uninstalling and reinstalling a bit easier: https://github.com/DeterminateSystems/nix-installer https://github.com/DeterminateSystems/nix-installer If you like NixOS' declarative style and service/configuration management capabilities, there's an awesome module system that lets you get a very similar experience on macOS: https://daiderd.com/nix-darwin/ https://daiderd.com/nix-darwin/ The ugly(?): The default build environment for packages on macOS uses a completely different toolchain than Nix uses on Linux. LLVM instead of GCC, libsystem instead of glibc. This is appropriate and generally invisible, but you may notice it and think about it when writing your own packages or something like that. Nix builds and the environment in general are a bit less 'pure' on macOS. Some of that is part of what I just mentioned above. Another aspect is that Nix builds are not sandboxed on macOS. I hope that helps! Overall, if you like NixOS, I think you will find lots to like about Nix on Mac. :)