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.