init mystuff

qemu 'network'
template fix
This commit is contained in:
Zsolt Alföldi
2026-03-01 00:17:47 +01:00
parent afed1b36bc
commit 3ffae9e404
3 changed files with 57 additions and 2 deletions

48
init_mystuff.sh Executable file
View File

@@ -0,0 +1,48 @@
set -ex
_user=alfoldi
_hostname=nokia-l13g4-sisu
_port=22
_hostname=localhost
_port=12222
# _ssh=alfoldi@nokia-l13g4-sisu
# _ssh="-e 'ssh -p 12222' alfoldi@localhost"
echo "
Host nokia-sisu
HostName $_hostname
User $_user
Port $_port
" >/tmp/sisu.ssh
function my_rsync() {
rsync -avzP -e "ssh -F /tmp/sisu.ssh" "$@"
}
ssh -F /tmp/sisu.ssh nokia-sisu "bash -c '
sudo mkdir -p /persists/sops/age/
sudo chown $USER -R /persists/sops/age/
'"
my_rsync --mkpath ~/.config/sops/age/keys.txt nokia-sisu:/persists/sops/age/
my_rsync ~/.ssh/ nokia-sisu:~/.ssh
# ssh -F /tmp/sisu.ssh nokia-sisu "bash -c '
# mkdir -p ~/workspace/home/nix
# cd ~/workspace/home/nix
# git clone git@github.com:alfonzso/home-manager.git || true
# cd home-manager
# home-manager --extra-experimental-features \'flakes nix-command\' --flake .#nokia build/switch
# '"
ssh -F /tmp/sisu.ssh nokia-sisu <<'EOF'
mkdir -p ~/workspace/home/nix
cd ~/workspace/home/nix
git clone git@github.com:alfonzso/home-manager.git || true
cd home-manager
sudo bash -c 'echo "trusted-users = root $SUDO_USER" >> /etc/nix/nix.conf'
sudo systemctl restart nix-daemon.service
home-manager --extra-experimental-features 'flakes nix-command' --flake .#nokia switch -b backup
EOF

View File

@@ -24,4 +24,6 @@ qemu-system-x86_64 \
-enable-kvm \ -enable-kvm \
-drive file=/tmp/test-disk.qcow2,format=qcow2 \ -drive file=/tmp/test-disk.qcow2,format=qcow2 \
"${_cdrom[@]}" \ "${_cdrom[@]}" \
-bios /usr/share/ovmf/OVMF.fd -bios /usr/share/ovmf/OVMF.fd \
-netdev user,id=net0,hostfwd=tcp::12222-:22 \
-device e1000,netdev=net0

View File

@@ -68,10 +68,15 @@ autoinstall:
encoding: b64 encoding: b64
content: "${NOKIA_CLIENT_KEY_B64}" content: "${NOKIA_CLIENT_KEY_B64}"
- path: /persists/sops/age/.keep
permissions: "0600"
owner: ${TARGET_USER}:${TARGET_USER}
content: ""
- path: /home/${TARGET_USER}/first_install.sh - path: /home/${TARGET_USER}/first_install.sh
permissions: "0755" permissions: "0755"
owner: ${TARGET_USER}:${TARGET_USER} owner: ${TARGET_USER}:${TARGET_USER}
# | # | |
# envsubst hack \ / # envsubst hack \ /
# ` # `
content: | content: |