• Stars
    star
    1,039
  • Rank 44,349 (Top 0.9 %)
  • Language
    Nix
  • License
    BSD 3-Clause "New...
  • Created about 3 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

Dustin's Nix / NixOS config

GitHub last commit

Psst: I can help write Nix at your company. Get in touch.

Overview

Hey, you made it! Welcome. πŸ€“

You've stumbled upon my personal journey with Nix. For over a year, I've been hacking away on this configuration. It drives my office PC, M1 Macbook, and virtual machines in my home lab. Along with syncthing to manage data, this Nix configuration guarantees I have a working, seamless experience across each machine I use.

Immutable, reproducible infrastructure rocks! It's game changing and I'll never go back to typing commands in a terminal.

While developing, I've done my best to keep it simple - for both future me and readers like you. You'll see that in how I've organized code, as I keep filename conventions the same across modules. To get you started, I've included step-by-step instructions on bootstrapping a new machine below.

Feel free to open a Github Issue if you run into any problems or have questions. Enjoy Nix!

Videos

NixOS

video-.11.mp4

MacOS

Updating dependencies with one command

Movie2.mp4

Instant Emacs 29 thanks to daemon mode

Movie2.mp4

Features

  • Multiple Nix and NixOS configurations, including desktop, laptop, server
  • Step-by-step instructions to start from zero, both x86 and MacOS platforms
  • Fully declarative MacOS dock and MacOS App Store apps
  • Defined using a single flake and two targets, not small files spread across collections of modules
  • Fully managed, auto-updating homebrew environment
  • Easily share config across Linux and Mac with both Nix and Home Manager
  • Minimal shell scripts covering basic functions for running systems
  • Bleeding edge Emacs that fixes itself, thanks to a community overlay
  • Extensively configured NixOS environment including clean aesthetic + window animations
  • Auto-loading of Nix overlays: drop a file in a dir and it runs (great for patches!)
  • Large Emacs literate configuration to explore (if that's your thing)
  • Optimized for simplicity and readability in all cases

Coming Soon

  • βœ… Persistence defined under XDG (#5)
  • Opt-in persistence using impermanence and zfs snapshot reset (#8)
  • Secrets managed with sops-nix (#6)

Layout

.
β”œβ”€β”€ bin          # Simple scripts used to wrap the build
β”œβ”€β”€ common       # Shared configurations applicable to all machines
β”œβ”€β”€ hardware     # Hardware-specific configuration
β”œβ”€β”€ darwin       # MacOS and nix-darwin configuration
β”œβ”€β”€ nixos        # My NixOS desktop-related configuration
β”œβ”€β”€ overlays     # Drop an overlay file in this dir, and it runs. So far mainly patches.
└── vms          # VM-specific configs running in my home-lab

Bootstrap New Computer

Step 1 - For MacOS, install Nix package manager

Install the nix package manager, add unstable channel:

sh <(curl -L https://nixos.org/nix/install) --daemon
nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
nix-channel --update

Step 2 - For NixOS, create a disk partition and install media

Follow this step-by-step guide for instructions to install using ZFS or ext3.

Step 3 - Install home-manager

Add the home-manager channel and install it:

nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update

Step 4 - If MacOS, install Darwin dependencies

Install Xcode CLI tools and nix-darwin:

xcode-select --install
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
./result/bin/darwin-installer

Step 5 - Build the environment

Download this repo and run:

./bin/build

Step 6 - Reboot computer

That's it. You're done.

Update Computer

Update dependencies

nix flake update

Run build

./bin/build

Read my occasional musings on Nix

Follow @dustinhlyons

"All we have to decide is what to do with the time that is given us." - J.R.R. Tolkien

Star History

Star History Chart