diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..d525137 --- /dev/null +++ b/CLAUDE.md @@ -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 \ No newline at end of file diff --git a/README.md b/README.md index 11e08eb..f837b41 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,15 @@ loadkeys de curl -L https://www.fischer.im/nixos/minimal-install --output install.sh chmod 744 ./install.sh ./install.sh + +reboot ``` +If you don't use the installation script, you need to follow the steps 2-8 + ### 2. Partitionierung -Das folgende Schema erstellt fuenf Partitionen auf `/dev/sda`: +Das folgende Schema erstellt view Partitionen auf `/dev/sda`: | Partition | Typ | Groesse | Mountpoint | |-------------|----------------|-------------------|------------| @@ -121,23 +125,39 @@ boot.loader = { ```bash nixos-install -``` -Nach der Installation wird ein Root-Passwort abgefragt. Danach: +# After the installation the script sets your root password. (Test1) -```bash reboot ``` ### 9. Nach dem ersten Start ```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 --update # Konfiguration anwenden -sudo nixos-rebuild switch +nixos-rebuild switch +reboot +``` + +### 10. Post Installation + +```bash # SMB-Zugangsdaten einrichten (falls Netzlaufwerke genutzt werden) sudo /etc/nixos/setup-smb-credentials.sh ``` diff --git a/scripts/minimal-install.sh b/scripts/minimal-install.sh old mode 100644 new mode 100755 index a45065a..0dd68f0 --- a/scripts/minimal-install.sh +++ b/scripts/minimal-install.sh @@ -61,6 +61,7 @@ swapon /dev/disk/by-label/swap nixos-generate-config --root /mnt +nixos-install # If root password wasn't set because the installation needed to be restarted. diff --git a/scripts/post-install.sh b/scripts/post-install.sh new file mode 100755 index 0000000..9d354ef --- /dev/null +++ b/scripts/post-install.sh @@ -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