All checks were successful
buildbot/nix-build .#checks.x86_64-linux.package-clan-merge Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-merge Build done.
buildbot/nix-build .#checks.x86_64-linux.package-action-ensure-tea-login Build done.
buildbot/nix-build .#checks.x86_64-linux.package-action-flake-update-pr-clan Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-clan-merge Build done.
buildbot/nix-build .#checks.x86_64-linux.package-job-flake-update-clan-core Build done.
buildbot/nix-build .#checks.x86_64-linux.package-job-flake-update-clan-homepage Build done.
buildbot/nix-build .#checks.x86_64-linux.treefmt Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-default Build done.
buildbot/nix-build .#checks.x86_64-linux.package-action-create-pr Build done.
buildbot/nix-build .#checks.x86_64-linux.package-action-flake-update Build done.
buildbot/nix-build .#checks.x86_64-linux.package-gitea Build done.
buildbot/nix-build .#checks.x86_64-linux.nixos-web01 Build done.
buildbot/nix-build .#checks.x86_64-linux.package-job-flake-update-clan-infra Build done.
buildbot/nix-eval Build done.
47 lines
1.2 KiB
Bash
47 lines
1.2 KiB
Bash
#!/usr/bin/env nix-shell
|
|
#!nix-shell -i bash -p coreutils sops openssh nix
|
|
|
|
# shellcheck disable=SC1008,SC1128
|
|
set -euox pipefail
|
|
|
|
if [[ -z "${HOST:-}" ]]; then
|
|
echo "HOST is not set"
|
|
exit 1
|
|
fi
|
|
if [[ -z "${FLAKE_ATTR:-}" ]]; then
|
|
echo "FLAKE_ATTR is not set"
|
|
exit 1
|
|
fi
|
|
if [[ -z "${SOPS_SECRETS_FILE:-}" ]]; then
|
|
echo "SOPS_SECRETS_FILE is not set"
|
|
exit 1
|
|
fi
|
|
|
|
tmp=$(mktemp -d)
|
|
trap 'rm -rf $tmp' EXIT
|
|
|
|
|
|
mkdir -p "$tmp/etc/ssh" "$tmp/var/lib/secrets"
|
|
for keyname in ssh_host_rsa_key ssh_host_rsa_key.pub ssh_host_ed25519_key ssh_host_ed25519_key.pub; do
|
|
if [[ "$keyname" == *.pub ]]; then
|
|
umask 0133
|
|
else
|
|
umask 0177
|
|
fi
|
|
sops --extract '["'$keyname'"]' -d "$SOPS_SECRETS_FILE" > "$tmp/etc/ssh/$keyname"
|
|
done
|
|
|
|
umask 0177
|
|
sops --extract '["initrd_ssh_key"]' -d "$SOPS_SECRETS_FILE" > "$tmp/var/lib/secrets/initrd_ssh_key"
|
|
# restore umask
|
|
umask 0022
|
|
|
|
ssh "root@$HOST" "modprobe dm-raid && modprobe dm-integrity"
|
|
|
|
nix run --refresh github:numtide/nixos-anywhere -- \
|
|
--debug \
|
|
--disk-encryption-keys /tmp/secret.key <(sops --extract '["cryptsetup_key"]' --decrypt "$SOPS_SECRETS_FILE") \
|
|
--extra-files "$tmp" \
|
|
--flake "$FLAKE_ATTR" \
|
|
"root@$HOST"
|