Merge pull request 'Update docs/nixos-anywhere.md' () from hensoko-docs-nixos-anywhere into main

Reviewed-on: 
Reviewed-by: teutat3s <teutat3s@noreply.git.pub.solar>
This commit is contained in:
teutat3s 2025-02-24 20:54:37 +00:00
commit 9b921f6c07
Signed by: pub.solar gitea
GPG key ID: F0332B04B7054873

View file

@ -1,13 +1,29 @@
# Deploying with nixos-anywhere
## On Target: Enter NixOS from non-NixOS host
In case you cannot boot easily into a nixos-installer image you can download the kexec installer image of NixOS and kexec into it:
```
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
```
```
mkdir -p /etc/secrets/initrd
ssh-keygen -t ed25519 -f /etc/secrets/initrd/ssh_host_ed25519_key
```
## Run Disko
```
nix run github:nix-community/nixos-anywhere -- --flake .#blue-shell root@194.13.83.205
nix run github:nix-community/nixos-anywhere -- --flake .#<hostname> --target-host root@<host> --phases disko
```
## On Target: Create inital ssh host key used in initrd
```
mkdir -p /mnt/etc/secrets/initrd
ssh-keygen -t ed25519 -f /mnt/etc/secrets/initrd/ssh_host_ed25519_key
```
## Run NixOS Anywhere
```
nix run github:nix-community/nixos-anywhere -- --flake .#<hostname> --target-host root@<host> --phases install,reboot
```