Skip to content

bkrishnan/nixos-config

Repository files navigation

🗂️ NixOS Configuration

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.

Repository Structure

.
├── 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

Design Principles

Shared vs. Machine-Specific

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.

Adding a New Machine

  1. Create hosts/<hostname>/hardware.nix with the machine's hardware-specific config.
  2. Add a new nixosConfigurations.<hostname> entry to flake.nix, importing both configuration.nix and hosts/<hostname>/hardware.nix.
  3. Document it in hosts/<hostname>/README.md.
sudo nixos-rebuild switch --flake .#<hostname>

External Devices

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

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.

Hosts

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

External Devices

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

Core Tools

  • 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)

Build & Deploy

# 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

Workflow

  1. System changes → edit configuration.nix or files under hosts/ / devices/sudo nixos-rebuild switch --flake .#imac
  2. User/program changes → edit files in home/programs/ or home.nix → same rebuild picks them up
  3. Commitgit add . && git commit -m "…" to track history

"Turning a legacy iMac into a future-proof Linux workstation, one GPU at a time."

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors