dotfiles
declarative system configurations with NixOS & Flakes
tools: nix, nixos flakes, home-manager, hyprland, systemd
project repository
philosophy
Traditional dotfiles management relies on symlinks, manually run install scripts, and ad-hoc package installations. If your system breaks or you switch hardware, recreating that exact environment is a headache.
This repository houses my entire OS and application setup as a declarative, version-controlled Nix Flake codebase. Tailored for my Framework Laptop 13 (AMD Ryzen AI 9), a single terminal command rebuilds the entire operating system, downloads packages, configures files, and registers system settings:
sudo nixos-rebuild switch --flake .#dchan-laptop
structure
The codebase is split into modular directories handling system-wide NixOS configurations, home-manager user spaces, and hardware specifications:
.dotfiles/
โโโ flake.nix # Flake entry point, defines inputs, outputs, system settings
โโโ configuration.nix # main system settings
โโโ INSTALLATION.md # step-by-step setup guide for fresh installations
โโโ hosts/ # hardware profiles
โ โโโ dchan-laptop/ # host-specific configuration for Framework 13 AMD
โ โโโ nvidia-intel-template/ # fallback template for NVIDIA/Intel machines
โโโ home/ # user space configuration managed by home-manager
โ โโโ home.nix # main user environment settings (packages, shell aliases)
โ โโโ [apps]/ # application configs (hyprland, waybar, kitty, helix, vscode, etc.)
โโโ terminalTools/ # submodule pointing to custom portable utilities (sls, ff, gitac)
โโโ scripts/ # system helper scripts (e.g., nix-rebuild-nice.sh)
highlights
1. hardware power management
For the Framework 13 host (dchan-laptop), we handle power saving and heat reduction for the Framework Storage Expansion Card by writing custom udev rules to enable USB autosuspend on the underlying SCSI disk controllers:
# excerpt from hosts/dchan-laptop/configuration.nix
services.udev.extraRules = ''
# Enable autosuspend on the parent Framework Storage Expansion USB device
ACTION=="add|change", SUBSYSTEM=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0005", ATTR{power/control}="auto"
# Configure power management for the SCSI disk backing the USB device
ACTION=="add|change", SUBSYSTEM=="scsi", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0005", ATTR{power/control}="auto", ATTR{power/autosuspend_delay_ms}="2000"
ACTION=="add|change", SUBSYSTEM=="scsi_disk", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0005", ATTR{manage_runtime_start_stop}="1", ATTR{manage_system_start_stop}="1"
'';
2. centralized themes
The entire systemโs styling (window borders, terminal backgrounds, waybar alerts, and text highlights) inherits its colors from a single, centralized theme variable declared inside flake.nix. It sets hex and RGB values for the standard base16 spectrum:
# flake.nix
theme = {
base00 = "1d1f21"; # primary dark background
base01 = "282a2e"; # secondary background
base0D = "bdb2ff"; # purple ; primary accent
base0B = "daa9ff"; # magenta ; secondary accent
};
These colors are mapped dynamically into configuration templates during home-manager evaluation, keeping my desktop style clean and cohesive.