Going declarative on macOS with Nix and Nix-Darwin

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • nixos-config

    Nix configuration for macOS / NixOS with starter templates, step-by-step guides, and more ✨ (by dustinlyons)

  • Yes, but he runs a NixOS VM inside MacOS, which is still very nice, but not what the article describes.

    Here's my configuration (600+ stars) running Nix on MacOS and NixOS at the same time, if it's helpful: https://github.com/dustinlyons/nixos-config

    This enables me to work at a desktop and be portable with my Macbook with essentially the same configuration and enables MacOS to feel more akin to a Linux machine (as close as I can get it).

  • nixos-config

    My NixOS configurations.

  • I've used Nix with Nix-Darwin on my macOS machines for a couple years now. The primary benefit is that when I get a new macOS machine, it's only three steps to having ALL my apps, configurations, etc. exactly as they were before:

    1. Download Nix installer (I prefer the one by Determinate Systems)

    2. Clone my Nix configs (public, so I don't even need secrets like keys yet)

    3. Run `make`

    I then wait around 15 minutes or so (mostly network time) and I'm good to go.

    ONE BIG RECOMMENDATION: I don't like using nix-darwin to manage graphical apps directly. It's a bit awkward. But, you can use nix-darwin to declaratively manage `homebrew`, so I still get my graphical apps from Homebrew. The linked article seems to suggest ditching homebrew entirely but I found its best as a mix of both worlds with Nix being the source of truth to manage everything else.

    You can find my configurations on GitHub but note that if you're new to Nix you would do better finding a simpler starting point: https://github.com/mitchellh/nixos-config (these are shared Nix configurations between macOS, Linux, and WSL on Windows).

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • dotfiles

    Nix Flakes-based method for applying system and application configurations across any platform supported by Nix. (by amodkala)

  • nixpkgs

    Nix Packages collection & NixOS

  • I'm also using NixOS and working on Go projects, and had to deal with out-of-date Go releases. Nixpkgs generally does get the latest Go versions pretty quickly, but only in the unstable channels, they're not backported to NixOS releases. You can just grab that one package out of nixpkgs-unstable or nixos-unstable, like:

        (import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz") {}).go_1_21

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts