2025-02-17 16:56:16 +00:00
|
|
|
# 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:
|
2024-08-24 03:06:17 +02:00
|
|
|
|
|
|
|
```
|
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
|
2024-08-24 03:06:17 +02:00
|
|
|
```
|
|
|
|
|
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
|
|
|
|
|
2024-08-24 03:06:17 +02:00
|
|
|
```
|
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 16:56:16 +00:00
|
|
|
```
|
|
|
|
|
2025-02-17 19:03:29 +00:00
|
|
|
## Run NixOS Anywhere
|
2025-02-17 16:56:16 +00:00
|
|
|
|
|
|
|
```
|
2025-02-17 19:17:32 +00:00
|
|
|
nix run github:nix-community/nixos-anywhere -- --flake .#<hostname> --target-host root@<host> --phases install,reboot
|
2024-08-24 03:06:17 +02:00
|
|
|
```
|