infra/docs/nixos-anywhere.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
852 B
Markdown
Raw Permalink Normal View History

# Deploying with nixos-anywhere
2025-02-17 19:03:29 +00:00
## On Target: Enter NixOS from non-NixOS host
2025-02-17 21:59:42 +01:00
In case you cannot boot easily into a nixos-installer image you can download the kexec installer image of NixOS and kexec into it:
```
2025-02-17 19:03:29 +00:00
curl -L https://github.com/nix-community/nixos-images/releases/download/nixos-unstable/nixos-kexec-installer-noninteractive-x86_64-linux.tar.gz | tar -xzf- -C /root
/root/kexec/run
```
2025-02-17 19:17:32 +00:00
## Run Disko
```
nix run github:nix-community/nixos-anywhere -- --flake .#<hostname> --target-host root@<host> --phases disko
```
2025-02-17 19:03:29 +00:00
## On Target: Create inital ssh host key used in initrd
```
2025-02-17 19:17:32 +00:00
mkdir -p /mnt/etc/secrets/initrd
ssh-keygen -t ed25519 -f /mnt/etc/secrets/initrd/ssh_host_ed25519_key
```
2025-02-17 19:03:29 +00:00
## Run NixOS Anywhere
```
2025-02-17 19:17:32 +00:00
nix run github:nix-community/nixos-anywhere -- --flake .#<hostname> --target-host root@<host> --phases install,reboot
```