Skip to content

lexy: re-install using ZFS and impermanence - #478

Open
dotlambda wants to merge 1 commit into
ocf:mainfrom
dotlambda:impermanence
Open

dotlambda wants to merge 1 commit into
ocf:mainfrom
dotlambda:impermanence

Conversation

@dotlambda

@dotlambda dotlambda commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Doing this on another host requires setting disko.devices.disk.main.device to the correct drive and using the following script:

#! /usr/bin/env nix-shell
#! nix-shell -p nixos-anywhere -i bash

set -eu

host="$1"

tmp="/tmp/reinstall/$host"
rm -rf "$tmp"
mkdir -p "$tmp/persist/etc" "$tmp/persist/var"
rsync -aAXUH --progress "root@$host:/etc/machine-id" "$tmp/persist/etc/"
rsync -aAXUH --progress "root@$host:/etc/ssh" "$tmp/persist/etc/"
rsync -aAXUH --progress "root@$host:/var/log" "$tmp/persist/var/"

tree "$tmp"
read -p "Continue? " -n 1 -r
echo
if [[ ! "$REPLY" =~ ^[Yy]$ ]]; then
    exit 1
fi

nixos-anywhere --flake ".#$host" --target-host "root@$host" --phases kexec,disko,install

rsync -aAXUH --progress --chown 0:0 "$tmp/persist" "root@$host:/mnt/"

ssh "root@$host" sh <<EOF
umount -Rv /mnt
swapoff -a
zpool export -a || true
nohup sh -c 'sleep 6 && reboot' >/dev/null 2>&1 &
EOF

read -p "Delete local copy? " -n 1 -r
echo
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
    rm -rf "$tmp"
fi

Comment thread profiles/desktop.nix Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant