diff --git a/devshell/commands.nix b/devshell/commands.nix index 5cdebb1..25b6034 100644 --- a/devshell/commands.nix +++ b/devshell/commands.nix @@ -59,6 +59,17 @@ in help = "SSH to a machine by NixOS system or home-manager config name"; command = ''exec ${sshMachine}/bin/ssh-machine "$@"''; } + { + name = "docs"; + category = "utilities"; + help = "Preview Markdown docs in the browser (default: `docs/README.md`)"; + command = '' + if [ $# -eq 0 ] || [[ "$1" == -* ]]; then + set -- "$PRJ_ROOT/docs/README.md" "$@" + fi + exec ${pkgs.go-grip}/bin/go-grip "$@" + ''; + } { name = "json2nix"; category = "utilities"; diff --git a/devshell/default.nix b/devshell/default.nix index 90153b2..73b928f 100644 --- a/devshell/default.nix +++ b/devshell/default.nix @@ -33,5 +33,6 @@ in '') home-manager jujutsu + go-grip ]; } diff --git a/docs/deployment.md b/docs/deployment.md index c31bbd1..b9a1021 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -116,6 +116,7 @@ command with no arguments for its help. From | `qemu-genmac` | Prints a random QEMU-suitable MAC (`52:54:00:xx:xx:xx`). | | `ssh-get-ed25519 ` | Prints a host's ed25519 pubkey via `ssh-keyscan`. | | `json2nix` | Converts JSON on stdin to formatted Nix. | +| `docs [file] [go-grip args]` | Previews Markdown in the browser with `go-grip` (default `docs/README.md`), rendered locally with live reload. | From [`devshell/install.nix`](../devshell/install.nix) (driven by `$INSTALLER`, the address of a running custom installer, SSHing as root with `.keys/deploy.key`):