From 78630287855397723fd5d81a7995c3eea4b25c12 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Thu, 14 May 2026 11:25:43 +0100 Subject: feat(remote-dev): add justfile with update/pull/switch/gc recipes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wraps the bootstrap-day-2 incantations so you don't have to remember `home-manager switch --impure --flake '.#vm' -b backup` and its zsh quoting gotcha. Recipes: - `just update` — pull + switch (the everyday one) - `just pull` — config-only changes, no nix rebuild - `just switch` — rebuild HM from the current checkout - `just gc` — expire HM generations >7d and gc the nix store README updated to use these. --- remote-dev/README.md | 23 +++++++++++++---------- remote-dev/justfile | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 remote-dev/justfile diff --git a/remote-dev/README.md b/remote-dev/README.md index 455b108..4622f31 100644 --- a/remote-dev/README.md +++ b/remote-dev/README.md @@ -30,24 +30,27 @@ GitHub on first launch. ## Updating after a dotfiles change -Two flavours of update: +Run from `~/.local/share/dotfiles/remote-dev`: ```sh -# (a) Config-only change (nvim/zellij/zsh/git/ssh): no rebuild needed. -git -C ~/.local/share/dotfiles pull +just update # pull + home-manager switch (handles everything) +``` + +Or piece-by-piece if you know which one you need: -# (b) Package set in home.nix changed: rebuild HM. -cd ~/.local/share/dotfiles/remote-dev -home-manager switch --impure --flake '.#vm' -b backup +```sh +just pull # config-only changes (nvim/zellij/zsh/git/ssh): no rebuild needed +just switch # rebuild home-manager from the current checkout ``` -> The flake ref is single-quoted because the shared zshrc enables -> `extendedglob`, which would otherwise interpret `.#vm` as a glob pattern -> and fail with `zsh: no matches found`. +> `just update` runs `pull` then `switch`. The home-manager invocation +> uses `--impure --flake '.#vm' -b backup`; the single-quotes around the +> flake ref matter because our zsh enables `extendedglob`, which would +> otherwise interpret `.#vm` as a glob pattern. ## Adding a tool -Edit `home.nix`, add to `home.packages`, then `home-manager switch`. +Edit `home.nix`, add to `home.packages`, then `just switch` (or `just update`). ## Single-shell policy (leaf tools only) diff --git a/remote-dev/justfile b/remote-dev/justfile new file mode 100644 index 0000000..db254df --- /dev/null +++ b/remote-dev/justfile @@ -0,0 +1,21 @@ +# Recipes for the remote-dev VM. Run from ~/.local/share/dotfiles/remote-dev. + +# Show available recipes (default) +default: + @just --list + +# Pull latest dotfiles and rebuild Home-Manager profile +update: pull switch + +# Pull latest dotfiles only (config-only changes, no nix rebuild) +pull: + git -C {{ justfile_directory() }}/.. pull --ff-only + +# Rebuild Home-Manager profile from the current checkout (no pull) +switch: + home-manager switch --impure --flake '{{ justfile_directory() }}#vm' -b backup + +# Garbage-collect old home-manager generations and nix store +gc: + home-manager expire-generations '-7 days' + nix-collect-garbage -d -- cgit v1.3.1