microvm.nix icon indicating copy to clipboard operation
microvm.nix copied to clipboard

`rebuild` helper script does not work with the `switch` arg

Open Ramblurr opened this issue 10 months ago • 5 comments

According to the docs, this should work:

nix run .#nixosConfigurations.my-microvm.config.microvm.deploy.rebuild [email protected] [email protected] switch

But when I run this I always get:

$ nix run .#nixosConfigurations.my-microvm.config.microvm.deploy.rebuild root@host root@target switch
Usage: /nix/store/kxrflcsnx1zayqaa389mn9zbfn9c3bby-microvm-rebuild/bin/microvm-rebuild root@<host> root@<target> [--use-remote-sudo] switch

Looking at the code, this makes sense, the conditional wrapping the "Usage" print will always trigger when "switch" is passed.

https://github.com/astro/microvm.nix/blob/d3a9b7504d420a1ffd7c83c1bb8fe57deaf939d2/nixos-modules/microvm/ssh-deploy.nix#L214-L240

Handling the "switch" isn't implemented AFAICT.

Ramblurr avatar Feb 17 '25 13:02 Ramblurr

Yeah, the arguments handling needs to be revised. IIRC that was the main reason I haven't tagged a stable version in a long time.

astro avatar Feb 17 '25 14:02 astro

Which commands do you want it to support besides switch?

Ramblurr avatar Feb 17 '25 18:02 Ramblurr

build, and --use-remote-sudo but independent of its position

astro avatar Feb 17 '25 20:02 astro

I read in another comment that there are plans to rewrite some scripts in python. Does that include this one? I could submit a PR either in bash or python.

Ramblurr avatar Feb 18 '25 06:02 Ramblurr

bash

astro avatar Feb 18 '25 23:02 astro