Dustin's Nix / NixOS config
Overview
These are my "dotfiles" contained within Nix deriviations that drive setup and configuration of, as of this writing
- my Macbook Pro
- a NixOS workstation sitting on my desk at home
- an old Thinkpad I use as an air-gapped machine
- virtual machines on my home-lab Proxmox server
In a previous life my configuration was driven by Guix, but with the release of new Apple Silicon I started exploring other options. Enter Nix and NixOS.
Features
- Simplicity as a guiding principle; Nix is notoriously confusing so make it easy to understand
- Entirely driven by my single Flake
- Supports sharing common config between an M1 Macbook Pro and NixOS PCs
- Simple bash scripts to build and switch environments
Bootstrap New Computer
Step 1 - For foreign distros (namely MacOS), install Nix package manager
Install the nix package manager:
sh <(curl -L https://nixos.org/nix/install) --daemon
nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
nix-channel --update
Step 2 - Install home-manager
Install the nix package manager:
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
Step 3 - If MacOS, install Darwin dependencies
Install nix-darwin, a native set of Nix modules for MacOS, and Xcode CLI tools.
xcode-select --install
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
./result/bin/darwin-installer
Step 4 - Build the environment
Grab the latest nix-config zip file from Github, move to the directory and run
./bin/mac-build
or
./bin/nixos-build
Step 5 - Add Yubikey and generate key
Insert laptop Yubikey and generate private keys
ssh-keygen -t ecdsa-sk
Step 6 - Reboot computer
That's it. You're done.
Get in touch
- Feedback or questions? Find me on Twitter.