Files
nixos-config/docs/system-maintenance.md
T
kiskaadee 3597e035d3 refactor: transition repository to a standalone declarative workstation
- Remove headless server configuration, homelab services, and legacy host directories (`hosts/server/`, `hosts/laptop/`).
- Consolidate privileged system files into a clean `system/` directory (`core.nix`, `hardware.nix`, `desktop.nix`).
- Migrate Home Manager configuration into functional domain modules under `home/` (`desktop.nix`, `dev.nix`, `shell.nix`).
- Update `flake.nix` to expose a single `laptop` target.
- Overhaul documentation (`architecture.md`, `AGENTS.md`, `README.md`) to reflect the standalone architecture and homelab decoupling.

This refactor eliminates the multi-host maintenance tax by decoupling server infrastructure into the Core repository and simplifying workstation management around domain-driven cohesion.
2026-09-12 16:22:58 -05:00

2.6 KiB

🛠️ System Maintenance Guide

This document describes how to update the system safely, verify its health post-update, and clean up disk space by removing old configurations.


🔄 Performing Clean & Secure System Updates

NixOS systems managed with Flakes lock dependency versions inside flake.lock. To update the system securely, follow this workflow:

Step 1: Update the Flake Inputs

Fetch the latest revisions of your inputs (e.g., nixpkgs, home-manager, and other plugins):

nix flake update

Step 2: Validate the Build & Formatting

Test-build the derivation without applying it to your bootloader. This prevents dirty installations or builder failures (such as Python PEP8 style errors) from affecting system configuration state:

nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link

Step 3: Switch & Apply the Update

Once the test build completes successfully, switch to the new generation:

sudo nixos-rebuild switch --flake .#laptop

🏥 Post-Update Health Checklist

Verify system health immediately after a major system switch:

  1. Systemd Service Status: Ensure all units are running and no critical services failed:
    systemctl --failed
    systemctl --user --failed
    
  2. Display & Window Manager: Verify that your graphics drivers, audio services (PipeWire/WirePlumber), and hotkeys are responsive.
  3. Secrets Integrity: Check that decrypted secrets are loaded correctly:
    ls -la /run/secrets/
    
  4. Network & Connectivity: Verify internet connectivity and NetworkManager status:
    systemctl status NetworkManager.service
    ping -c 3 google.com
    

🧹 Cleaning Up Old Generations

Nix keeps older versions (generations) of your system configuration so you can roll back instantly. However, this takes up storage space.

Step 1: List System Generations

To view all available system generations:

sudo nix-env --list-generations --profile /nix/var/nix/profiles/system

Step 2: Delete Old Generations

  • Remove older than X days:
    sudo nix-env --delete-generations +5d --profile /nix/var/nix/profiles/system
    
  • Remove specific generations:
    sudo nix-env --delete-generations 42 43 --profile /nix/var/nix/profiles/system
    

Step 3: Collect Garbage (Reclaim Disk Space)

Deleting generations only updates configuration links. To actually free up disk space and prune unused dependencies:

# Run garbage collection for system and user profiles
sudo nix-collect-garbage -d
nix-collect-garbage -d