Simple workable config for M1 Macbook Pro Monterey 12.0.1 with nix, flakes, nix-darwin and home-manager

Hi there,

I was looking for a recent how-to with a few bells a whistles to setup nix-darwin with home-manager with flakes on my new M1 Macbook Pro and ended up doing a small gist, with code heavily inspired from the awesome GitHub - malob/nixpkgs: My Nix system configs!

The other walk throughs I found seem to have some workarounds that aren’t needed anymore, so the installation is actually pretty simple.

I included things in the config that I know I end up needing all the time, like overlays that are available in home-manager, including x86 version of packages that don’t build on Apple Silicon yet and a few things I didn’t know I needed yet (like nix-index and touch ID for sudo, straight from @malob’s repo!).

I tried to minimise the number of files, which means I inlined some patches in the flake.nix which can be removed when the corresponding PRs are merged upstream. For a more thorough and modular setup (including dealing with multiple machines and a neat primaryUser trick) refer to GitHub - malob/nixpkgs: My Nix system configs!

Here is the gist and hope it helps Setup nix, nix-darwin and home-manager from scratch on an M1 Macbook Pro · GitHub

Merry Christmas :christmas_tree:

Jun

10 Likes

And if you have the patience and want to see and hear me blabbering about this config then check out this youtube video: https://youtu.be/KJgN0lnA5mk (which should be done processing shortly).

4 Likes

Figuring this will be a thread many using aarch64 and flakes, want to share something useful I learned: --option system x86_64-darwin can be used as a suffix to interact with flakes without aarch64 support.

1 Like