NixOS Debugging
Build Failures
Check the build log
sh
# Rebuild with verbose output sudo nixos-rebuild switch --flake .#nixos --show-trace 2>&1 | tee /tmp/rebuild.log
Common causes
- •Broken upstream package: Comment it out with
# Broken buildand document in a commit - •Hash mismatch: Update the hash (use
lib.fakeHashto get the correct one) - •Deprecated options: Check the NixOS release notes for migration paths
- •Kernel incompatibility: Pin the kernel or the problematic driver version
Service Debugging
sh
# Check service status systemctl status <service-name> # View service logs journalctl -u <service-name> -b # List failed services systemctl --failed
Driver Issues (especially NVIDIA)
- •Config is in
hosts/nixos/hardware/nvidia.nix - •Suspend/hibernate issues often involve systemd service ordering — see
docs/nvidia-suspend-fix.md - •Check kernel compatibility when updating flake inputs
After Fixing
- •Rebuild and verify:
sudo nixos-rebuild switch --flake .#nixos - •Document the fix in
docs/if the problem was non-trivial - •Commit with a descriptive message:
fix(<scope>): <description>