A modular, flake-based NixOS configuration using Home Manager (integrated as a NixOS module). Designed to support multiple machines — a shared base config, per-machine hardware modules, and per-device declarations all live in dedicated folders.
.
├── flake.nix # Entry point — pins nixpkgs + home-manager
├── configuration.nix # Shared system config (services, fonts, users, …)
├── hardware-configuration.nix # Auto-generated by nixos-generate-config — do not edit
├── home.nix # Home Manager root — imports home/programs/
│
├── hosts/ # Per-machine hardware modules
│ └── imac/
│ ├── hardware.nix # iMac GPU, Wi-Fi, ZFS, kernel params
│ └── README.md # iMac-specific notes and rationale
│
├── devices/ # Per-device NixOS modules + documentation
│ ├── brother-printer.nix # Brother HL-L2300D (IPP network printer)
│ ├── brother-printer.md
│ ├── brother-scanner.nix # Brother MFC-J410W (brscan4 network scanner)
│ └── brother-scanner.md
│
├── home/
│ └── programs/ # Modular Home Manager program declarations
│ ├── packages.nix
│ ├── fish.nix
│ ├── git.nix
│ ├── emacs.nix
│ ├── vscode.nix
│ ├── hyprland.nix
│ ├── i3.nix
│ └── …
│
└── config/ # Raw config files (non-Nix) sourced by Home Manager
└── emacs/
└── init.el
configuration.nix holds everything common across all machines: users, locale, fonts, shell, core services, and Home Manager wiring. Machine-specific tweaks (GPU drivers, kernel params, Wi-Fi firmware) live in hosts/<hostname>/hardware.nix and are imported in configuration.nix.
- Create
hosts/<hostname>/hardware.nixwith the machine's hardware-specific config. - Add a new
nixosConfigurations.<hostname>entry toflake.nix, importing bothconfiguration.nixandhosts/<hostname>/hardware.nix. - Document it in
hosts/<hostname>/README.md.
sudo nixos-rebuild switch --flake .#<hostname>Each peripheral gets its own file in devices/. The .nix file is imported in configuration.nix; the .md file documents setup and troubleshooting.
Home Manager runs as a NixOS module (no separate activation step needed). Program config lives in home/programs/; complex native-language configs live in config/<program>/ and are sourced via home.file.
| Hostname | Machine | Notes |
|---|---|---|
imac |
Late 2012 iMac 27-inch | Hybrid Intel/NVIDIA (Nouveau), Broadcom Wi-Fi; rpool/data (native ZFS encryption) auto-mounted at boot — README |
| Device | Type | Config | Docs |
|---|---|---|---|
| Brother HL-L2300D | Network printer | brother-printer.nix | brother-printer.md |
| Brother MFC-J410W | Network scanner | brother-scanner.nix | brother-scanner.md |
- Compositor: Hyprland (Wayland) + i3 (X11 fallback)
- Login Manager: Ly TUI
- Terminals: Alacritty, Foot
- Shell: Fish
- Editor: Emacs (declarative packages via
emacsWithPackages), VS Code - Snapshots: Sanoid (automated ZFS snapshot management, every 15 min)
# Rebuild and switch (primary workflow)
sudo nixos-rebuild switch --flake .#imac
# Test without making it the boot default
sudo nixos-rebuild test --flake .#imac
# Build without activating
sudo nixos-rebuild build --flake .#imac
# Update flake inputs to latest
nix flake update
# Garbage-collect old generations
sudo nix-collect-garbage -d- System changes → edit
configuration.nixor files underhosts//devices/→sudo nixos-rebuild switch --flake .#imac - User/program changes → edit files in
home/programs/orhome.nix→ same rebuild picks them up - Commit →
git add . && git commit -m "…"to track history
"Turning a legacy iMac into a future-proof Linux workstation, one GPU at a time."