{ inputs, pkgs, ... }:
pkgs.writeShellApplication {
  name = "update-instance";
  runtimeInputs = [
    pkgs.nixos-rebuild
  ];
  text = ''
    instance="''${1:-}"
    connect_host="''${2:-$1}"
    # --fast makes building on MacOS possible.
    nixos-rebuild switch --fast --flake "${inputs.self}#$instance" --target-host "$connect_host" --build-host "$connect_host" --show-trace --use-remote-sudo
  '';
}
