Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

NixOS Dotfiles (v5)

Deploy Docs Built with Nix

A declarative, multi-host NixOS configuration built with Nix Flakes, flake-parts, and Home Manager. This setup features an automated discovery system that dynamically generates host configurations and modules.

📚 Read the Documentation

🚀 Quick Start

Installation

  1. Boot the Installer: Use the custom ISO provided by this flake:

    nix build .#installer-iso
    
  2. Partition & Install:

    # Using Disko (automated)
    just install <hostname>
    
  3. Manual Install:

    # Clone the repo
    git clone https://github.com/xiro-codes/dotfiles.v5.nix /etc/nixos
    cd /etc/nixos
    
    # Generate hardware config
    nixos-generate-config --show-hardware-config > systems/<hostname>/hardware.nix
    
    # Install
    nixos-install --flake .#<hostname>
    

Architecture: Automated Discovery

This repository utilizes a modular discovery engine (parts/discovery/) that scans the file system to build the flake. This eliminates the need to manually register new files in flake.nix.

  • Systems: Every directory in /systems is automatically converted into a nixosConfiguration.
  • System Modules: Found in /modules/system. Any directory with a default.nix is automatically exported as a NixOS module.
  • Home Modules: Found in /modules/home. These are automatically exported for use within Home Manager.
  • Home Configurations: Standalone Home Manager configurations are generated from user@hostname.nix files in /home.
  • Packages: Custom packages in /packages are automatically built for the current system.
  • Dev Shells: Every directory in /shells is automatically exported as a devShell (accessible via nix develop .#<name>).
  • Deploy Nodes: Systems with a deploy.nix file are automatically added to deploy-rs configuration.
  • Templates: Project templates in /templates are automatically exported.

💻 Managed Systems

Onix

  • Role: Home Server
  • IP: 10.0.0.65
  • Bootloader: UEFI with systemd-boot
  • Key Features: Central file server, Gitea instance, media server, and Pi-hole.
  • Hosted Domains: dashboard.onix.home, git.onix.home, tv.onix.home, plex.onix.home, ch7.onix.home, comics.onix.home, audiobooks.onix.home, dl.onix.home, yt.onix.home, pihole.onix.home, docs.onix.home, cache.onix.home

Ruby

  • Role: Primary Workstation
  • IP: 10.0.0.66
  • Bootloader: UEFI with Limine
  • Key Features: High-performance workstation, local backup management, and comprehensive network share mounts (Music, Books, Backups).

Sapphire

  • Role: AI Services & Secondary Workstation
  • IP: 10.0.0.67
  • Bootloader: UEFI with Limine
  • Key Features: Local LLM and AI services (Ollama, Open WebUI), remote mounts.
  • Hosted Domains: ui.sapphire.home, ai.sapphire.home

🛠️ Key Modules & Features

  • Backup Manager: Automated borg-based backups to /mnt/zima/Backups with smart exclusions for development artifacts (node_modules, target, .direnv).
  • Secrets Management: Integrated via sops-nix. Handles sensitive data like SSH keys and API tokens (e.g., Gemini API keys).
  • Desktop Environment: Both systems default to Hyprland with automated theming via Stylix.
  • User Manager: Simplifies user creation and shell (Fish) configuration.
  • Share Manager: Centralized logic for mounting network storage across nodes.

⌨️ Command Reference (just)

The justfile provides several helpers for system administration:

CommandAction
justList all available commands

Life (Local System Management)

CommandAction
just switchSwitch local system configuration using nh
just bootSet next boot generation using nh
just rebuildStandard nixos-rebuild switch (impure)

Deploy (Remote Management)

CommandAction
just deploy <host>Deploy to a remote node using deploy-rs
just deploy-allDeploy all nodes in the flake
just checkSafety check before deploying (eval and dry-run)
just gc <host>Garbage collect a remote node to free space

Secrets

CommandAction
just edit-secretsEdit encrypted SOPS secrets
just update-keysUpdate system keys

Backups

CommandAction
just init-backupInitialize borg backup repository
just run-backupRun borg backup manually
just mount-backup <host>Mount backup archive to /.recovery
just umount-backupUnmount backup archive
just check-timerCheck when next backup is scheduled
just list-backupsShow all current backups

Install

CommandAction
just install <host>Install a system from scratch using disko
just rescueQuick fix for a borked system (assumes std labels)
just bake-recoveryBurn a new ISO to the recovery partition

Dev

CommandAction
just run-testBuild and launch the custom Installer ISO in QEMU
just clean-testClear the test environment
just init-undoInitialize local .undo_dir for Nixvim persistent undo
just clear-undosClear ephemeral undo directory for current repo

Docs

CommandAction
just gen-docsGenerate module documentation to docs/
just serve-docsServe docs locally and open in browser
just build-docsBuild the static documentation site
just view-docsView docs in terminal

📚 Module Documentation

All custom modules are documented with auto-generated option references:

To regenerate documentation: just gen-docs

💿 Custom Installer

This flake includes a specialized installer ISO (#installer-iso) for deploying new nodes.

  • How to use: Boot the ISO and manually partition the target disk, then use just install <host> to deploy the configuration.
  • Features: Includes necessary tools for manual system installation and disko-based automated partitioning.

📁 Repository Structure

home/               # User-specific Home Manager configurations
modules/
    home/           # Reusable Home Manager modules
    system/         # Reusable NixOS modules
packages/           # Custom Nix packages
parts/              # Flake logic (Discovery engine, docs, shells)
secrets/            # SOPS-encrypted secrets
shells/             # Development shells (auto-discovered)
systems/            # Host-specific configurations (Ruby, Sapphire)
templates/          # Scaffolding for new modules and projects