1
0
Fork
You've already forked nixos
0
No description
  • Nix 88.9%
  • Batchfile 11%
  • Shell 0.1%
Find a file
Paul Berz 25e877de85 Fix KVM: remove deprecated qemu.ovmf.enable (auto-included in 25.11)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026年03月16日 17:07:50 +01:00
configs Add dynamic swayidle timeout: 10min on trusted networks, 2min otherwise 2026年03月16日 15:50:29 +01:00
hosts/laptop Fix KVM: remove deprecated qemu.ovmf.enable (auto-included in 25.11) 2026年03月16日 17:07:50 +01:00
.gitignore new 2026年03月01日 19:30:16 +01:00
disko.nix new 2026年02月25日 19:05:13 +01:00
flake.lock updated ofs-cli 2026年03月06日 09:44:05 +01:00
flake.nix Add cdial as flake input and home-manager package 2026年03月05日 23:45:04 +01:00
install.cmd new 2026年02月25日 19:05:13 +01:00
README.md Fix dock display matching after laptop swap 2026年03月16日 11:06:14 +01:00
rebuild.sh new 2026年02月28日 14:14:12 +01:00
update-app.sh new example 2026年03月06日 09:46:03 +01:00

Laptop Install

Was du VOR der Installation anpassen musst

  1. flake.nix: specialArgs.diskDevice auf deine Ziel-SSD setzen (z. B. /dev/nvme0n1, /dev/sda).
  2. hosts/laptop/secrets.nix lokal anlegen (wird nicht in Git versioniert):
cp hosts/laptop/secrets.nix.example hosts/laptop/secrets.nix
  1. In hosts/laptop/secrets.nix folgende Werte setzen: userName, hostName, initialPassword.
  2. Optional in hosts/laptop/configuration.nix: time.timeZone, i18n.defaultLocale, console.keyMap.

Wo setze ich das LUKS-Passwort?

Das LUKS-Passwort wird nicht in einer Datei hinterlegt.
Du vergibst es beim disko-Lauf interaktiv, wenn cryptsetup nach dem Passwort fragt:

sudo nix --experimental-features 'nix-command flakes' run github:nix-community/disko -- --mode disko --flake "path:$PWD#laptop"

Installation

sudo -i
cd /tmp
git clone <DEIN-REPO-URL> nix-laptop
cd nix-laptop
# Optional: falls deine SSD nicht /dev/nvme0n1 ist
# sed -i 's|diskDevice = "/dev/nvme0n1";|diskDevice = "/dev/DEIN_DISK_DEVICE";|' flake.nix
nix --experimental-features 'nix-command flakes' run github:nix-community/disko -- --mode disko --flake "path:$PWD#laptop"
nixos-install --flake "path:$PWD#laptop"
reboot

Nach dem ersten Boot

  1. Mit dem in hosts/laptop/secrets.nix unter initialPassword gesetzten Passwort einloggen.
  2. User-Passwort direkt auf ein dauerhaftes Passwort ändern:
passwd <dein-username>
  1. Optional Root-Passwort setzen:
sudo passwd root
  1. Kurzer Check:
sudo systemctl status btrfs-snapshot-frequent.timer
nmtui

Dotfiles mit chezmoi

chezmoi wird über Home Manager als Paket installiert. Nach einem nixos-rebuild kannst du deine Dotfiles so starten:

chezmoi init <git-repo-url>
chezmoi apply

Troubleshooting

Wenn nixos-install beim Bootloader mit folgender Meldung abbricht:

Failed to get blkid info ... install-grub.pl line 213.
Failed to install bootloader

dann in hosts/laptop/configuration.nix sicherstellen, dass gesetzt ist:

boot.loader.grub.enableCryptodisk = true;

Danach nixos-install --flake "path:$PWD#laptop" erneut ausfuehren.

Wenn nach einem Laptop-, Dockingstation- oder Monitor-Wechsel das automatische Monitor-Layout unter Sway nicht mehr stimmt, dann die kanshi-Eintraege in hosts/laptop/configuration.nix pruefen. Relevant ist der Block environment.etc."kanshi/config".text.

Die Output-Identifier holst du dir mit:

swaymsg -t get_outputs

Wichtig: kanshi matched auf den kompletten Identifier in einfachen Anfuehrungszeichen, z. B. BOE NE160QDM-NZ6 Unknown oder Fujitsu Siemens Computers GmbH B24-8 TE Pro YV9S384384, nicht auf Portnamen wie eDP-1, DP-9 oder DP-10.

Nach der Aenderung anwenden mit:

sudo nixos-rebuild switch
swaymsg reload

Recovery nach SSD-/Laptop-Wechsel

Wenn die NVMe in ein anderes Geraet umgezogen wurde, fehlt oft nur der UEFI-Boot-Eintrag im NVRAM des alten Rechners. Die Daten auf der SSD sind dann meist noch in Ordnung, aber das neue UEFI findet keinen NixOS-Booteintrag.

Die Konfiguration setzt deshalb zusaetzlich:

boot.loader.grub.efiInstallAsRemovable = true;

Dadurch wird neben dem normalen Eintrag auch der UEFI-Fallback unter EFI/BOOT/BOOTX64.EFI installiert.

Wichtig: Fuer die Recovery im Live-System nicht nixos-enter ... nixos-rebuild boot verwenden. Das kann mit /mnt/etc/static: file exists scheitern, weil nixos-enter das Zielsystem anders vorbereitet als nixos-install.

Stattdessen:

sudo -i
cryptsetup open /dev/disk/by-partlabel/crypt cryptlvm
vgchange -ay
mount -o subvol=@ /dev/vg0/root /mnt
# WICHTIG: alle Btrfs-Subvolumes mounten, sonst landet der Nix-Store
# im falschen Subvolume und der Boot schlaegt mit "init not found" fehl!
mkdir -p /mnt/nix /mnt/home /mnt/var/log
mount -o subvol=@nix,compress=zstd:3,noatime,ssd,space_cache=v2 /dev/vg0/root /mnt/nix
mount -o subvol=@home,compress=zstd:3,noatime,ssd,space_cache=v2 /dev/vg0/root /mnt/home
mount -o subvol=@var-log,compress=zstd:3,noatime,ssd,space_cache=v2 /dev/vg0/root /mnt/var/log
mkdir -p /mnt/boot /mnt/boot/efi
mount /dev/disk/by-partlabel/boot /mnt/boot
mount /dev/disk/by-partlabel/EFI /mnt/boot/efi
cd /tmp
git clone <DEIN-REPO-URL> nix-laptop
cd nix-laptop
nixos-install --root /mnt --flake "path:$PWD#laptop" --no-root-password

Danach im Live-System kurz pruefen:

find /mnt/boot/efi/EFI -maxdepth 3 -type f | sort

Mindestens einer dieser Pfade sollte existieren:

  • /mnt/boot/efi/EFI/NixOS/
  • /mnt/boot/efi/EFI/BOOT/BOOTX64.EFI