Files
nixos-vorlagen/README.md
T
2026-06-16 21:49:01 +02:00

321 lines
11 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# NixOS Gaming Base
Diese Basis-Config ist als wiederverwendbare Vorlage für ein NixOS-Gaming-Desktop-System gedacht und nutzt `nixos-unstable`, `Chaotic-Nyx` und getrennte Desktop-/Treiber-Configs. Fokus:
- aktueller Kernel
- umschaltbare Grafik-Configs für AMD oder Nvidia
- Chaotic `mesa-git` und 32-Bit-Libs für Steam/Proton
- PipeWire + Gaming-/Desktop-Audio-Tools
- Steam, Gamescope, MangoHud, Lutris, Heroic, LACT
- Basis für RGB- und Gaming-Peripherie
- Desktop-Auswahl zwischen KDE, GNOME, Budgie, Hyprland und COSMIC
## Dokumentation
- [SETUP_FUER_FREUNDE.md](docs/SETUP_FUER_FREUNDE.md): Einstieg und kompletter Setup-Prozess
- [CACHIX_ANLEITUNG.md](docs/CACHIX_ANLEITUNG.md): Cachix und schnellere Builds
- [GAMING_CUSTOMIZATION_GUIDE.md](docs/GAMING_CUSTOMIZATION_GUIDE.md): Gaming, Steam, Proton und Desktop-Anpassung
- [MESA_GIT_ANLEITUNG.md](docs/MESA_GIT_ANLEITUNG.md): Mesa-Git und GPU-Treiber
- [COSMIC_SETUP_ANLEITUNG.md](docs/COSMIC_SETUP_ANLEITUNG.md): COSMIC Desktop
- [KERNEL_GAMING_TWEAKS.md](docs/KERNEL_GAMING_TWEAKS.md): Kernel-Auswahl und Performance
- [PODMAN_DISTROBOX.md](docs/PODMAN_DISTROBOX.md): Podman und Distrobox
- [UPDATER_ANLEITUNG.md](docs/UPDATER_ANLEITUNG.md): `nixos-update`
## Struktur
- `flake.nix`: Einstieg über `nixos-unstable` + `chaotic-cx/nyx`
- `configuration.nix`: Host-spezifische Einstiegsdatei
- `modules/base.nix`: Boot, Locale, Nix, Firmware, Governor, Basis-Tweaks
- `modules/packages.nix`: zentraler Ort für eigene Zusatzpakete
- `modules/chaotic-nyx.nix`: Chaotic-Nyx Aktivierung, `allowUnfree`, `mesa-git`
- `modules/graphics/mesa-amd.nix`: AMDGPU + Mesa/RADV Basis
- `modules/graphics/mesa-amd-opencl.nix`: AMD mit AMDVLK + OpenCL/ROCm
- `modules/graphics/nvidia.nix`: Nvidia-Treiber Basis mit proprietären Modulen
- `modules/graphics/nvidia-open.nix`: Nvidia mit offenen Kernel-Modulen
- `modules/audio/pipewire.nix`: PipeWire, JACK, Pulse, Audio-Tools
- `modules/gaming.nix`: Steam, Gamescope, Launcher-Stack
- `modules/gaming/wine-proton.nix`: Wine-, Proton- und Compatibility-Tools
- `modules/containers/podman-distrobox.nix`: Podman Container Runtime + Distrobox
- `modules/kernel/linux-default.nix`: Standard Linux Kernel (stabil)
- `modules/kernel/linux-zen.nix`: Linux Zen (Gaming-optimiert)
- `modules/kernel/linux-hardened.nix`: Linux Hardened (Sicherheit)
- `modules/gaming-tweaks.nix`: optionale Extra-Parameter für Gaming-Performance
- `modules/kernel/linux-cachyos.nix`: aktiver Gaming-Kernel in `configuration.nix`
- `modules/desktop/common.nix`: gemeinsame Desktop-Pakete
- `modules/desktop/kde.nix`: KDE Plasma 6 + SDDM
- `modules/desktop/gnome.nix`: GNOME + GDM
- `modules/desktop/budgie.nix`: Budgie
- `modules/desktop/hyprland.nix`: Hyprland + SDDM
- `modules/desktop/cosmic.nix`: schlanke COSMIC-Basis
- `modules/desktop/cosmic-max.nix`: COSMIC DE + Cosmic-Greeter (Wayland-native)
- `modules/peripherals.nix`: RGB-, Maus- und USB-Helfer
## Quick Start - So nutzt ihr dieses Repo
Ihr möchtet diese Config für euer NixOS-Gaming-System nutzen? Hier geht's los:
### 1. Repo klonen
```bash
git clone <DIESES-REPO> ~/nixos-config
cd ~/nixos-config
```
### 2. Hardware-Konfiguration hinzufügen
Nach einer frischen NixOS-Installation:
```bash
sudo cp /etc/nixos/hardware-configuration.nix ./hardware-configuration.nix
```
### 3. Basis-Einstellungen anpassen (configuration.nix)
Öffnet `configuration.nix` und ändert diese Werte:
```nix
hostName = "euer-computer-name"; # z.B. "gaming-rig"
userName = "euer-nutzername"; # z.B. "max"
fullName = "Euer Name"; # z.B. "Max Mustermann"
```
### 4. Desktop und GPU wählen
Ändert diese Zeilen nach eurer Hardware:
```nix
desktopConfig = ./modules/desktop/kde.nix; # oder: cosmic-max.nix, gnome.nix, hyprland.nix
graphicsConfig = ./modules/graphics/mesa-amd.nix; # oder: nvidia.nix, nvidia-open.nix, mesa-amd-opencl.nix
kernelConfig = ./modules/kernel/linux-cachyos.nix; # oder: linux-zen.nix, linux-xanmod.nix, linux-default.nix
enableExtraGamingTweaks = true; # false für konservativere Defaults
```
**Nicht sicher? Empfehlungen:**
- **AMD-GPU**: `mesa-amd.nix` + `kde.nix`
- **NVIDIA-GPU**: `nvidia.nix` + `kde.nix`
- **Modern/Wayland**: `cosmic-max.nix` (Achtung: weniger Gaming-optimiert als KDE)
- **Kernel**: `linux-cachyos.nix` für Gaming, `linux-zen.nix` als konservative Alternative
### 5. System bauen
```bash
sudo nixos-rebuild switch --flake .#template
sudo reboot
```
Das war's! Nach dem Neustart startet euer neues System.
### Weitere Infos
- **Gaming-Setup & Customization**: Siehe [`docs/GAMING_CUSTOMIZATION_GUIDE.md`](docs/GAMING_CUSTOMIZATION_GUIDE.md)
- **Zu COSMIC wechseln**: Siehe [`docs/COSMIC_SETUP_ANLEITUNG.md`](docs/COSMIC_SETUP_ANLEITUNG.md)
- **Mehr Pakete installieren**: Edit `modules/packages.nix`
- **Update-Befehl nutzen**: `nixos-update`, `nixos-update boot` oder `nixos-update update-inputs`
## Vorlage anpassen
Die wichtigsten Platzhalter stehen direkt in `configuration.nix`:
```nix
hostName = "example-host";
userName = "gamer";
fullName = "Gaming User";
```
Passe diese Werte vor dem ersten Build an. In `modules/base.nix` sind `Europe/Berlin`, `de_DE.UTF-8` und `de` als Defaults gesetzt und können überschrieben werden.
Zusätzliche allgemeine Pakete kannst du in `modules/packages.nix` eintragen.
## Desktop und GPU auswählen
Die Auswahl passiert direkt oben in `configuration.nix`. Du änderst diese Zeilen:
```nix
desktopConfig = ./modules/desktop/kde.nix;
graphicsConfig = ./modules/graphics/mesa-amd.nix;
kernelConfig = ./modules/kernel/linux-cachyos.nix;
enableExtraGamingTweaks = true;
```
Für den Desktop sind diese Werte möglich:
- `./modules/desktop/kde.nix`
- `./modules/desktop/gnome.nix`
- `./modules/desktop/budgie.nix`
- `./modules/desktop/hyprland.nix`
- `./modules/desktop/cosmic.nix`
- `./modules/desktop/cosmic-max.nix`
Für die GPU bzw. den Treiber sind diese Werte möglich:
- `./modules/graphics/mesa-amd.nix`
- `./modules/graphics/mesa-amd-opencl.nix`
- `./modules/graphics/nvidia.nix`
- `./modules/graphics/nvidia-open.nix`
Beispiele:
KDE + AMD
```nix
desktopConfig = ./modules/desktop/kde.nix;
graphicsConfig = ./modules/graphics/mesa-amd.nix;
```
KDE + AMD mit OpenCL/AMDVLK
```nix
desktopConfig = ./modules/desktop/kde.nix;
graphicsConfig = ./modules/graphics/mesa-amd-opencl.nix;
```
GNOME + Nvidia
```nix
desktopConfig = ./modules/desktop/gnome.nix;
graphicsConfig = ./modules/graphics/nvidia.nix;
```
Hyprland + Nvidia
```nix
desktopConfig = ./modules/desktop/hyprland.nix;
graphicsConfig = ./modules/graphics/nvidia.nix;
```
KDE + Nvidia Open Kernel Module
```nix
desktopConfig = ./modules/desktop/kde.nix;
graphicsConfig = ./modules/graphics/nvidia-open.nix;
```
COSMIC (Modern Wayland-Native) + AMD
```nix
desktopConfig = ./modules/desktop/cosmic.nix;
graphicsConfig = ./modules/graphics/mesa-amd.nix;
```
COSMIC Max + AMD
```nix
desktopConfig = ./modules/desktop/cosmic-max.nix;
graphicsConfig = ./modules/graphics/mesa-amd.nix;
```
COSMIC Max + Nvidia
```nix
desktopConfig = ./modules/desktop/cosmic-max.nix;
graphicsConfig = ./modules/graphics/nvidia.nix;
```
Es wird dabei immer genau ein Desktop-Modul und genau ein Grafik-Modul importiert, nicht alle auf einmal.
In `modules/graphics/nvidia.nix` sind `modesetting`, `nvidiaSettings` und `nvidiaPackages.latest` bereits gesetzt.
## Kernel auswählen
Der aktive Kernel wird in `configuration.nix` über `kernelConfig` gewählt. Standard in diesem Repo ist CachyOS:
```nix
kernelConfig = ./modules/kernel/linux-cachyos.nix;
```
Empfehlungen:
- `linux-cachyos.nix`: beste Standardwahl für diesen Gaming-Desktop
- `linux-zen.nix`: konservative Gaming-Alternative, wenn CachyOS Probleme macht
- `linux-default.nix`: stabiler Fallback
- `linux-hardened.nix`: Security-Fokus, nicht ideal für Gaming
- `linux-xanmod.nix`: experimenteller Performance-Kernel
Weitere Details stehen in [`docs/KERNEL_GAMING_TWEAKS.md`](docs/KERNEL_GAMING_TWEAKS.md).
### Empfehlung für AMD
- `mesa-amd.nix` ist die einfachste und sinnvollste Standardwahl für die meisten Gaming-Systeme mit AMD.
- `mesa-amd-opencl.nix` ist interessant, wenn du zusätzlich OpenCL/ROCm brauchst oder explizit AMDVLK testen willst.
- Wenn du nur spielen willst und keinen speziellen Compute- oder Vulkan-Workaround brauchst, nimm zuerst `mesa-amd.nix`.
### Empfehlung für Nvidia
- `nvidia.nix` ist die Standardwahl für die meisten Systeme, wenn du maximale Kompatibilität mit aktuellen Spielen willst.
- `nvidia-open.nix` ist für Systeme gedacht, auf denen du die offenen Nvidia-Kernel-Module nutzen möchtest.
- Wenn du nicht gezielt testen willst, nimm zuerst `nvidia.nix`.
### Empfehlung für COSMIC
- `cosmic.nix` ist die schlanke COSMIC-Variante mit den wichtigsten Desktop-Helfern.
- `cosmic-max.nix` ist die vollere COSMIC-Variante mit zusätzlichen COSMIC-Tools und Applets.
- Geeignet für Linux-Puristen und AMD-Benutzer; mit XWayland-Fallback auch für NVIDIA möglich.
- Wenn du einfach nur COSMIC nutzen willst, starte mit `cosmic.nix`.
- Wenn du gezielt die COSMIC-Extras willst, nimm `cosmic-max.nix`.
- Gaming: 7/10 Solide für Linux-Native und Proton-Spiele, aber weniger spezialisiert als KDE.
- Tipp: Für maximale Gaming-Kompatibilität und Tweakbarkeit nimm KDE Plasma statt COSMIC.
## Wine und Proton
Die Wine-/Proton-Helfer liegen jetzt in `modules/gaming/wine-proton.nix` und werden automatisch über `modules/gaming.nix` importiert.
Enthalten sind aktuell:
- `wineWow64Packages.stable`
- `winetricks`
- `protontricks`
- `protonplus`
- `umu-launcher`
- `dxvk`
- `vkd3d-proton`
- `steam-run`
Damit hast du direkt die typischen Werkzeuge für:
- Steam Proton mit `protontricks`
- zusätzliche Compatibility Tools über `protonplus`
- Wine-/Non-Steam-Starts über `umu-launcher`
- manuelles Debugging und Prefix-Arbeit mit `winetricks`
## Chaotic-Nyx & Mesa-Git
Die Flake bindet `github:chaotic-cx/nyx/nyxpkgs-unstable` direkt ein und importiert
`chaotic.nixosModules.default`.
**Mesa-Git aktivieren/deaktivieren:** Siehe `modules/chaotic-nyx.nix` und die Datei [`docs/MESA_GIT_ANLEITUNG.md`](docs/MESA_GIT_ANLEITUNG.md).
**Was ist Mesa-Git?**
- Neueste tägliche GPU-Treiber-Builds von der Mesa-Entwicklung
- Ideal für moderne AMD-GPUs mit aktuellen Spielen
- Fallback-Option falls Probleme auftreten
- **Wichtig:** NVIDIA-Nutzer brauchen Mesa-Git nicht (benutzen proprietäre Treiber)
## Nach der Installation
1. Die vom Installer erzeugte `hardware-configuration.nix` nach `./hardware-configuration.nix` kopieren.
2. `hostName`, `userName` und `fullName` in `configuration.nix` anpassen.
3. In `configuration.nix` `desktopConfig` und `graphicsConfig` auf die gewünschten Module setzen.
4. Optional Locale, Tastatur und Zeitzone anpassen.
5. Passwort für den Benutzer setzen:
```bash
passwd <dein-userName>
```
6. Optional die Flake-Inputs aktualisieren:
```bash
nix flake update
```
7. System aktivieren:
```bash
sudo nixos-rebuild switch --flake .#template
```
## Späterer Ausbau
- Desktop-spezifische Pakete und Defaults weiter tunen, z. B. Autologin, Keyring-Policy, Flatpak
- OBS / Discord / OpenRGB-Profile / Fancontrol
- Btrfs-Subvolumes, Snapshots, Impermanence
- spezielle Kernel- oder Scheduler-Tweaks, falls du sie wirklich brauchst