c0c0n3 / teadal.proto

Messing around with cloud infra for https://www.teadal.eu.
MIT License
4 stars 1 forks source link

NixOS remote deployment w/ sudoer #1

Open c0c0n3 opened 1 year ago

c0c0n3 commented 1 year ago

Find out how to do a remote Flake deployment with a sudoer instead of root.

I tried it with the dev VM, using admin as a user but got an error message saying Nix couldn't run sudo. To reproduce, start the dev VM

$ qemu-system-x86_64 \
    -machine q35,vmport=off -cpu host -smp 2 -m 4G -accel hvf \
    -display none \
    -nic user,hostfwd=tcp::10022-:22 \
    devm.img.qcow2

run our Nix shell and cd into nix/nodes/devm. Then run

$ export NIX_SSHOPTS='-p 10022'
$ nixos-rebuild switch --fast --flake .#devm \
    --target-host admin@localhost --build-host admin@localhost \
    --use-remote-sudo

# Enter the VM's admin password when prompted—unless you changed the
# default config, the password is `abc123`.
c0c0n3 commented 1 year ago

It doesn't look like you can do it out of the box, at least not w/ passwords. Read this