blob: a707ed460db38a2fff920c811ed141c1b4e6b114 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/bin/sh
set -eu
hostname="${1:-$(hostname)}"
if [ "$(id -u)" -ne 0 ]; then
echo "Please run as root!" >&2
exit 1
fi
if [ "$hostname" = "nixos" ]; then
echo "The hostname is the default one, that is not right for sure." >&2
echo "Please specify the correct hostname as the first argument!" >&2
exit 1
fi
if [ ! -s /.personal-secrets.key ]; then
echo "Please paste the personal secret key (terminate using ^D)" >&2
cat >/.personal-secrets.key
fi
mkdir -p ~/.ssh
cat >~/.ssh/config <<EOF
Match User git Host cynerd.cz
IdentityFile ~/.ssh/nixos-secret-access
EOF
echo "Please paste the SSH access key now (terminate using ^D):" >&2
cat >~/.ssh/nixos-secret-access
trap "rm -f ~/.ssh/nixos-secret-access" EXIT
nix-shell -p git --command \
"nixos-rebuild switch --flake 'git+https://git.cynerd.cz/nixos-personal#$hostname' --fast"
|