2.5 KiB
2.5 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Overview
NixOS dotfiles repository using Nix Flakes for managing multiple machines. Configuration is in French (comments, docs).
Build & Deploy Commands
# Rebuild and switch configuration (local)
sudo nixos-rebuild switch --flake .#<hostname>
# Rebuild on remote machine
nixos-rebuild switch --flake .#<hostname> --target-host beastie@<ip> --sudo
# Bootstrap new machine with nixos-anywhere
nixos-anywhere --flake .#generic --target-host root@<ip> \
--generate-hardware-config nixos-generate-config ./hosts/generic/hardware-configuration.nix
# Generate custom ISO
nixos-generate --format iso --configuration ./iso/customiso.nix -o ~/Downloads/nixos.iso
# Update flake inputs
nix flake update
# Update secrets after adding new host key
sops updatekeys secrets.yaml
nix flake update mysecrets
Architecture
Flake Inputs:
nixpkgs-stable(25.05) andnixpkgs-unstablechannelsdiskofor declarative disk partitioningsops-nixfor encrypted secretsmysecrets- local git repo at/home/beastie/nixos/secrets(required dependency)
Hosts: generic (ISO), test-kvm (stable), home-nix (unstable), work-nix (unstable)
Module Hierarchy:
modules/core/- Applied to ALL hosts (grub, ssh, packages, users, tty, system)modules/optionnals/- Selectively imported per hostmodules/optionnals/hosts/<hostname>.nix- Host-specific networking, servicesmodules/optionnals/desktop/- Desktop environment modules (Hyprland, apps)
Key Patterns
Custom Options (modules/optionnals/options.nix):
my.laninterface,my.ipv4address,my.ipv4netmask,my.ipv4gateway,my.wolipv6address
Special Args passed to all modules via flake.nix:
hostnameandusername- used for host/user-specific configuration
Secrets (sops-nix):
- Encrypted YAML in separate
mysecretsrepo - Referenced via
config.sops.secrets.<name>.pathorconfig.sops.templates - Age encryption with SSH host keys
XDG Config Distribution:
- Desktop configs (hyprland, waybar, kitty, rofi) use
environment.etc."xdg/<app>".source - Host-specific variants:
hyprland-${hostname}.conf
Important Considerations
- Test changes on
test-kvmbefore deploying to production hosts mysecretsflake input must exist locally at/home/beastie/nixos/secrets- Different hosts use different
stateVersion(25.05 vs 25.11) - Core module changes affect ALL machines