No description
  • Nix 95.5%
  • Shell 2.3%
  • Lua 2.1%
Find a file
2026-08-06 17:14:11 -06:00
home fix(zellij): remove Alt+f binding causing false ToggleFloatingPanes via VS Code terminal 2026-07-24 23:47:20 -06:00
hosts chore(minerva): remove dead inputs-stable parameter 2026-07-07 19:43:23 -06:00
modules/darwin chore(ares): replace betterbird with thunderbird 2026-08-05 23:54:51 -06:00
packages fix(nuvio-desktop): correct dock entry tag and installPhase 2026-07-19 14:59:43 -06:00
scripts fix(kanata): remove redundant sudo from launchd plist 2026-05-24 01:18:14 -06:00
.gitignore chore: add result to gitignore 2026-06-30 16:28:01 -06:00
.sops.yaml feat(sops): use sops for netbird login 2026-05-06 01:11:47 -06:00
AGENTS.md docs: clarify atomic commit grouping rule 2026-07-29 19:44:57 -06:00
commitlint.config.js feat(git): add commitlint for conventional commit validation 2026-05-02 03:17:15 -06:00
flake.lock fix(flake): pin remusa-homebrew-tap to futo-notes sha fix 2026-08-06 17:14:11 -06:00
flake.nix fix(homebrew): strip command_wrapper and postflight_steps from homebrew-cask 2026-08-03 00:04:55 -06:00
lefthook.yml feat(git): add commitlint for conventional commit validation 2026-05-02 03:17:15 -06:00
README.md docs: update hosts 2026-05-22 23:02:59 -06:00
secrets.yaml chore(sops): add copyparty/mount-url secret 2026-06-08 23:43:25 -06:00

Nix Configuration

Unified NixOS and macOS (nix-darwin) configuration for personal systems.

Prerequisites

  • Nix with flakes and commands enabled
  • Git

macOS Setup (nix-darwin)

  1. Install Xcode command line tools (if not already installed):

    xcode-select --install
    # If already installed, you may see: "command line tools are already installed"
    
  2. Install Nix:

    curl -L https://install.determinate.systems/nix | sh -s -- install --prefer-upstream-nix
    
  3. Restart shell or source profile:

    source /nix/var/nix/profiles/*/etc/profile.d/nix-daemon.sh
    
  4. Generate SSH key and add to Forgejo:

    ssh-keygen -t ed25519 -C "s4mxdhid@zurimail.org"
    # Add pub key to http://minerva.lan:8080/user/settings/keys
    
  5. Clone the config:

    git clone ssh://forgejo@minerva.lan/s4mxdhid/nixos-config.git
    cd nixos-config
    
  6. Bootstrap nix-darwin:

    sudo --set-home nix run nix-darwin/master#darwin-rebuild -- switch --flake .#<hostname>
    

Change hostname:

sudo scutil --set HostName <new_name>
sudo scutil --set LocalHostName <new_name>
sudo scutil --set ComputerName <new_name>

After bootstrapping, darwin-rebuild will be available in your PATH:

sudo darwin-rebuild switch --flake .#$(scutil --get LocalHostName)

Structure

nix-config/
├── flake.nix              # Root flake - exports all host configurations
├── modules/               # Shared modules
│   └── darwin/           # Shared macOS configuration
│       ├── default.nix   # Main shared config
│       └── netbird.nix   # NetBird service
├── hosts/                # Host-specific configurations
│   ├── ares/             # MacBook Air M2 (macOS)
│   ├── vulcan/           # Mac Mini M4 (macOS)
│   ├── mars/             # MacBook Air M2 (omarchy)
│   └── minerva/          # AOOSTAR server (NixOS)
├── home/                 # Shared Home Manager configuration
│   ├── home.nix          # Main HM config with cross-platform imports
│   └── programs/         # Program-specific HM modules
└── programs/             # (legacy home modules directory)

Hosts

Host OS Description
ares macOS MacBook Air M2 - laptop
vulcan macOS Mac Mini M4 - desktop
mars omarchy MacBook Air M2 (TODO)
minerva NixOS AOOSTAR N1 Pro

Building

macOS (ares/vulcan)

sudo darwin-rebuild switch --flake .#$(scutil --get LocalHostName)

NixOS (minerva)

sudo nixos-rebuild switch --flake .#$(hostname)

Update flake inputs

nix flake update

Garbage collection

# macOS & NixOS
sudo nix-collect-garbage --delete-older-than 7d

Shared Configuration

Home Manager

Home Manager manages user-level packages and configurations for all hosts:

  • Cross-platform: git, zsh, starship, mise, atuin, fzf, zoxide, yazi, zellij, btop, bottom, localsend, espanso, jujutsu, delta
  • macOS-only: aerospace (disabled), sketchybar (disabled), paneru (window manager with gestures)

Darwin Modules

modules/darwin/ contains shared macOS configuration imported by both ares and vulcan:

  • Homebrew packages and casks
  • System defaults (Dock, Finder, etc.)
  • Window managers (paneru)
  • NetBird service

NetBird Setup

NetBird is configured to auto-connect on macOS hosts.

Setup for new machines:

  1. Get a setup key from your NetBird admin dashboard

  2. Create the setup key file:

    echo 'YOUR_NETBIRD_SETUP_KEY' > ~/.netbird_setup_key
    
  3. Rebuild the system:

    sudo darwin-rebuild switch --flake .#$(scutil --get LocalHostName)
    

The activation script will automatically connect NetBird using the setup key.

Adding a New Host

macOS

  1. Copy an existing host directory:

    cp -r hosts/ares hosts/new-host
    
  2. Update hosts/new-host/configuration.nix comment (line 7)

  3. Add to flake.nix:

    darwinConfigurations."new-host" = nix-darwin.lib.darwinSystem {
      specialArgs = { inherit inputs; };
      modules = [
        ./hosts/new-host/configuration.nix
        # ... other modules
      ];
    };
    
  4. Update README.md with the new host

NixOS

  1. Create directory: hosts/new-host/
  2. Copy configuration.nix and hardware-configuration.nix from existing NixOS host
  3. Update hostname in configuration
  4. Add to flake.nix under nixosConfigurations
  5. Update README.md

Clone the Repository (New Machine)

If setting up a new machine to use this config from the local Forgejo instance:

1. Generate an SSH key on the new PC: ssh-keygen -t ed25519 -C "s4mxdhid@zurimail.org"
2. Add the public key to Forgejo at <http://minerva.lan:8080/user/settings/keys>
3. Then clone with: git clone ssh://forgejo@minerva.lan/s4mxdhid/nixos-config.git

Troubleshooting

Build fails with "No space left on device"

sudo nix-collect-garbage --delete-older-than 7d

Cask installation fails (mv: cannot overwrite non-directory)

This error occurs when there's a stale cask directory in the Homebrew cache. The app may have been manually installed or the cache is corrupted.

# Replace 'app-name' with the failing cask (e.g., ungoogled-chromium)
rm -rf /opt/homebrew/Caskroom/app-name
rm -rf /Applications/AppName.app

Then rebuild:

sudo darwin-rebuild switch --flake .#$(scutil --get LocalHostName)

Build fails with stale inputs

nix flake update

Home Manager packages not appearing

Make sure home-manager module is included in the host's flake configuration.

Paneru not starting

Check that ~/.paneru.toml exists:

ls -la ~/.paneru.toml

If missing, rebuild the system to regenerate.

Secrets (sops-nix)

To encrypt secrets with sops:

# Generate age key (one-time setup)
mkdir -p ~/.config/sops/age
age-keygen -o ~/.config/sops/age/keys.txt
age-keygen -Y ~/.config/sops/age/keys.txt  # shows public key

# Add public key to .sops.yaml
# keys: - &pubkey AGE_PUBLIC_KEY_HERE

# Encrypt secrets.yaml
sops --encrypt --in-place secrets.yaml

# Edit encrypted file
sops secrets.yaml

The encrypted file can be committed to the repo safely.

Notes

  • .DS_Store files are gitignored
  • Comments in Nix files are preserved
  • nixfmt can be used to format Nix files: nixfmt ~/.config/nix/*.nix

Permission fix

sudo chown -R root:nixbld /nix
sudo chmod -R 755 /nix/store
sudo chmod -R 1777 /nix/var/nix/temproots
sudo pkill nix-daemon
nix-collect-garbage
nix flake update