My NixOS, nix-darwin and Home Manager configurations.
I use NixOS inside of a OrbStack on a M3 Mac running macOS. In addition to this, I use nix-darwin to configure macOS with nix-darwin
. Both of these setups also use Home Manager.
There are two kinds of modules:
modules/
, which define NixOS or nix-darwin level options.home-modules/
, which define Home Manager options on both NixOS and macOS.
The modules mentioned above are imported inside of two configuration generation functions:
./nixos.nix
, this function generates anixosConfiguration
./darwin.nix
, this function generates adarwinConfiguration
These fucntions are used in ./flake.nix
's nixosConfigurations
and darwinConfigurations
NOTE: These instructions are out of date
- Do a project-wide search of my username,
cor
and replace it withyour_username
. Be careful not to replace things that are not my username, such as "core". - In
./nixos.nix
, replace the value ofhashedPassword
with one you've generated withmkpasswd -m sha-512
See here for more info. - In
./programs/git.nix
, changeuserName
andextraConfig.github.user
to your GitHub username. Also changesigning.key
to the public GPG key you use for your GitHub account.
- Download OrbStack
- Click Machines > New Machine
- Select NixOS 24.05, CPU type Apple
- Click create
- Download this repo into
/home/cor/nixos-config
- Run
make
NOTE: macOS Nix config is not required for setting up the NixOS VM. For instructions on this, check the previous section
Make sure not to install Homebrew or Xcode Command Line Tools!
- Do a clean install macOS, deny analytics.
- Install
Nix
on macOS with the installer - In ~, execute
nix-shell -p git --command "git clone https://github.com/cor/nixos-config"
- Install
nix-darwin
with the nix-darwin installer. - Restart Terminal.app
sudo mv /etc/nix/nix.conf /etc/nix/nix.conf.original
- In
~/nixos-config
, executenix-shell --no-sandbox -p cmake --command "make switch-darwin"
- Download 1Password and browser extension
- From 1Password, download SSH keys:
id_ed25519
andid_ed25519.pub
. Move them to~/.ssh~
- From 1Password, download GPG keys:
secret-key-backup.asc
. Import them with:gpg --import ./secret-key-backup.asc
. Afterwards, runrm ./secret-key-backup.asc
- From 1Password, download GPG
trust-db-backup.txt
. Import them with:gpg --import-ownertrust < ./trustdb-backup.txt
, Afterwards, runrm ./trustdb-backup.txt
-
OrbStack
-
Ghostty
-
Tailscale
-
1Password
-
Brave
-
Firefox
-
Signal
-
Telegram
-
ElementX
-
Portal
-
reMarkable
-
World Clock
-
Balance Lock
-
Vivid
-
Hidden Bar
-
Advanced Screen Share
-
Gifski
-
Photomator
-
Pixelmator
-
Final Cut Pro
-
AeroSpace
-
Lasso
- Change Screenshots folder and file format
- Disable "automatically re-arrange spaces"
- Disable auto brightness and true tone
- Set capslock to control
- Disable "recent apps" in Dock
- Add screenshots folder to Dock
- Sign in to email accounts
- Set Safari search engine to DuckDuckGo
- Enable Safari develop menu
- Disable autocorrect everywhere
- Enable "download full photos library" in Photos
To bootstrap the SD card:
- Enter orbstack
nix build '.#nixosConfigurations.raspberry-pi.config.system.build.sdImage'
cp ./result/sd-image/nixos-...-linux.img.zst /Users/cor/Desktop
- On macOS, download rpi-imager
- Insert SD card into MacBook
- Flash the
.img.zst
from your Desktop to the rPi's sd card. - Insert sd card into raspberry pi and click the power button
Your Raspberry Pi should now be bootstrapped and you should be able to SSH into it.
To udpate the pi from the pi itself
- clone this repo on the pi
sudo nixos-rebuild switch --flake .#raspberry-pi
Config is partially based on https://github.com/mitchellh/nixos-config