notiz:nixos-cheats
Inhaltsverzeichnis
NixOS cheats
Nix Flakes
Nix Build Host Configuration
nix build .#nixosConfiguration.hostname.config.system.build.toplevel
Neuen NixOS Host von Flake installieren
sudo nixos-install --no-root-passwd --root /mnt --flake git+https://git.clerie.de/clerie/nixfiles.git#hydra-2
Konfiguration mit eigenen Paketquellen für eine VM bauen
nixos-rebuild build-vm -I nixos-config=vm.nix -I nixpkgs=$PWD
SD-Karten Image für ARM bauen
nix build -f "<nixpkgs/nixos>" config.system.build.sdImage -I nixos-config=configuration.nix -I nixpkgs=channel:nixos-unstable --system aarch64-linux
NixOS in Xen
imports = [ (modulesPath + "/virtualisation/xen-domU.nix") ];
NixOS hardware-configuration.nix
sudo nixos-generate-config --show-hardware-config
Deklaration einer Option finden
sudo nixos-option system.build
Paket bauen
nix-build -E "with import <nixpkgs> {}; callPackage ./. {}"
Channel updates
nix-channel --update nixos
Nix Store aufräumen / Alte Generationen entfernen
Im Normalfall reicht das hier:
sudo reboot sudo nix-collect-garbage -d
Alle Generationen die älter als 14 Tage sind entfernen:
sudo nix-env --delete-generations 14d
Ungenutze Pakete entfernen:
sudo nix-store --gc
notiz/nixos-cheats.txt · Zuletzt geändert: 2022/10/15 13:33 von clerie