[TASK] Improve documentation

This commit is contained in:
Sebastian Fischer 2026-02-10 20:07:06 +01:00
parent dcf7ee4a09
commit 7a4283ba3a
4 changed files with 97 additions and 5 deletions

61
CLAUDE.md Normal file
View File

@ -0,0 +1,61 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## What This Is
Personal NixOS system configuration for host `cesium` — a QEMU/KVM-virtualized x86_64 desktop workstation. Uses NixOS with Home Manager (channel-based, no Flakes). NixOS version is locked to 25.11.
## Commands
```bash
# Rebuild and apply configuration (aliased as 'rebuild')
sudo nixos-rebuild switch
# Rebuild with package upgrades (aliased as 'update')
sudo nixos-rebuild switch --upgrade
# Test configuration without persisting (loads into current session only)
sudo nixos-rebuild test
# Build without applying (useful to check for errors)
sudo nixos-rebuild build
# Optimize store and garbage collect (aliased as 'ngc')
sudo nix-store --optimise && sudo nix-collect-garbage -d
# After first install: setup SMB credentials
sudo /etc/nixos/setup-smb-credentials.sh
```
## Architecture
Entry point is `config/configuration.nix`, which imports all other modules:
```
config/configuration.nix # Top-level: imports all modules, enables Home Manager
├── hardware-configuration.nix # Auto-generated (gitignored), QEMU guest hardware
├── common.nix # System-wide: bootloader, locale, GNOME, PipeWire, packages
├── mounts.nix # CIFS/SMB mounts to TrueNAS (automount with systemd)
├── services.nix # Docker (custom data root /home/docker), ddev
├── users/sebastian.nix # User account, groups, SSH askpass
│ └── imports home.nix # Home Manager config for this user
├── home.nix # User environment: apps, shell, git, scripts, Flatpak
├── scripts.nix # Custom shell scripts (composer, lazydocker, gclb)
├── vm-guest.nix # Optional: SPICE agent for VM clipboard/file sharing
└── vm-host.nix # Optional: KVM/QEMU host with libvirtd, virt-manager
```
Key design patterns:
- `common.nix` handles all system-level config (boot, locale, desktop, audio, auto-updates, garbage collection)
- `home.nix` handles all user-level config via Home Manager (applications, shell aliases, git, vim, GTK theme, GNOME extensions, Flatpak activation scripts)
- `scripts.nix` defines Docker-wrapped CLI tools (composer, lazydocker) and git helpers using `writeShellScriptBin`
- `mounts.nix` uses systemd automount with 60s idle timeout for TrueNAS SMB shares
- `vm-guest.nix` and `vm-host.nix` are optional modules (not imported by default in configuration.nix)
## Conventions
- **Commit messages** use `[TASK]` prefix (e.g., `[TASK] Add filemounts`)
- **Formatting**: 2-space indentation for `.nix` files, 4-space for everything else (see `.editorconfig`)
- **Unfree packages** are allowed (`nixpkgs.config.allowUnfree = true`)
- `hardware-configuration.nix` is gitignored — it's auto-generated per machine

View File

@ -24,11 +24,15 @@ loadkeys de
curl -L https://www.fischer.im/nixos/minimal-install --output install.sh curl -L https://www.fischer.im/nixos/minimal-install --output install.sh
chmod 744 ./install.sh chmod 744 ./install.sh
./install.sh ./install.sh
reboot
``` ```
If you don't use the installation script, you need to follow the steps 2-8
### 2. Partitionierung ### 2. Partitionierung
Das folgende Schema erstellt fuenf Partitionen auf `/dev/sda`: Das folgende Schema erstellt view Partitionen auf `/dev/sda`:
| Partition | Typ | Groesse | Mountpoint | | Partition | Typ | Groesse | Mountpoint |
|-------------|----------------|-------------------|------------| |-------------|----------------|-------------------|------------|
@ -121,23 +125,39 @@ boot.loader = {
```bash ```bash
nixos-install nixos-install
```
Nach der Installation wird ein Root-Passwort abgefragt. Danach: # After the installation the script sets your root password. (Test1)
```bash
reboot reboot
``` ```
### 9. Nach dem ersten Start ### 9. Nach dem ersten Start
```bash ```bash
curl --output release.tar.gz https://gitea.fischer.im/sebastian/nixos-cesium/archive/[0.0.2].tar.gz
tar xzf release.tar.gz
chmod 744 nixos-cesium/script/post-install.sh
./nixos-cesium/script/post-install.sh
```
If you don't use the post-installation script, follow the next step
```bash
cp -r ~/nixos-cesium/config/* /etc/nixos/
# Remember to activate vm-guest.nix or vm-host.nix in configuration.nix
nix-channel --add https://github.com/nix-community/home-manager/archive/release-25.11.tar.gz home-manager nix-channel --add https://github.com/nix-community/home-manager/archive/release-25.11.tar.gz home-manager
nix-channel --update nix-channel --update
# Konfiguration anwenden # Konfiguration anwenden
sudo nixos-rebuild switch nixos-rebuild switch
reboot
```
### 10. Post Installation
```bash
# SMB-Zugangsdaten einrichten (falls Netzlaufwerke genutzt werden) # SMB-Zugangsdaten einrichten (falls Netzlaufwerke genutzt werden)
sudo /etc/nixos/setup-smb-credentials.sh sudo /etc/nixos/setup-smb-credentials.sh
``` ```

1
scripts/minimal-install.sh Normal file → Executable file
View File

@ -61,6 +61,7 @@ swapon /dev/disk/by-label/swap
nixos-generate-config --root /mnt nixos-generate-config --root /mnt
nixos-install
# If root password wasn't set because the installation needed to be restarted. # If root password wasn't set because the installation needed to be restarted.

10
scripts/post-install.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env sh
sudo -i
cp -r ~/nixos-cesium/config/* /etc/nixos/
nix-channel --add https://github.com/nix-community/home-manager/archive/release-25.11.tar.gz home-manager
nix-channel --update
nixos-rebuild switch