Hacker News new | ask | show | jobs
by x0rg 1415 days ago
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.
1 comments

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 <<<$(cat *.nix | wc -l)/$(ls | wc -l)
  32
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