updated
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
# NixOS Update
|
||||
|
||||
`nixos-update` ist der eingebaute Update-Helfer für dieses Repo. Er zieht zuerst den neuesten Stand aus Git und führt danach `nixos-rebuild` mit deiner lokalen Flake-Konfiguration aus.
|
||||
|
||||
Der Befehl wird über [`modules/updater.nix`](../modules/updater.nix) ins System installiert.
|
||||
|
||||
## Repo im Modul setzen
|
||||
|
||||
Repo-Pfad und Flake-Ziel stehen direkt in `modules/updater.nix`. Für Freunde und für ein dauerhaftes System-Repo ist `/etc/nixos` der empfohlene Ort.
|
||||
|
||||
```nix
|
||||
repo_root="/etc/nixos"
|
||||
flake_target="template"
|
||||
```
|
||||
|
||||
## Standard
|
||||
|
||||
```bash
|
||||
nixos-update
|
||||
```
|
||||
|
||||
Das ist der normale Alltagsfall:
|
||||
|
||||
```bash
|
||||
git pull --ff-only
|
||||
sudo nixos-rebuild switch --flake /pfad/zum/repo#<flake_target>
|
||||
```
|
||||
|
||||
## Modi
|
||||
|
||||
```bash
|
||||
nixos-update switch
|
||||
nixos-update boot
|
||||
```
|
||||
|
||||
- `switch` aktiviert die neue Generation sofort. Das ist auch der Standard.
|
||||
- `boot` baut die neue Generation, aktiviert sie aber erst für den nächsten Neustart.
|
||||
|
||||
## Weitere Optionen
|
||||
|
||||
```bash
|
||||
nixos-update update-inputs
|
||||
nixos-update dry-run
|
||||
```
|
||||
|
||||
- `update-inputs` führt vor dem Rebuild noch `nix flake update` aus.
|
||||
- `dry-run` zeigt die Schritte und Befehle an, ohne sie auszuführen.
|
||||
|
||||
## Typische Beispiele
|
||||
|
||||
```bash
|
||||
nixos-update
|
||||
nixos-update update-inputs
|
||||
nixos-update boot
|
||||
nixos-update boot update-inputs
|
||||
nixos-update dry-run
|
||||
```
|
||||
|
||||
## Hinweise
|
||||
|
||||
- Das Skript nutzt `git pull --ff-only`. Wenn dein lokaler Branch und der Remote auseinanderlaufen, stoppt der Pull bewusst.
|
||||
- Wenn `repo_root` für den normalen Benutzer nicht beschreibbar ist, laufen Git- und Flake-Befehle mit `sudo`. Das passt besonders für `/etc/nixos`.
|
||||
- Vor jedem größeren Schritt zeigt das Skript den Abschnitt und den konkreten Befehl an.
|
||||
- Bei lokalen uncommitteten Änderungen erscheint vor dem Pull eine Warnung.
|
||||
- `nixos-update` fragt per `sudo -v` nach deinem Passwort, sobald es sudo wirklich braucht.
|
||||
- `nixos-sync` und `update-nixos` bleiben als Alias erhalten und rufen intern ebenfalls `nixos-update` auf.
|
||||
- Wenn du das Repo an einen anderen Ort legst, ändere `repo_root` direkt in `modules/updater.nix`.
|
||||
|
||||
## Hilfe
|
||||
|
||||
```bash
|
||||
nixos-update help
|
||||
```
|
||||
Reference in New Issue
Block a user