| 1 | usage: valley self-update [-v] [--retry | --rollback | --pin | --unpin] |
| 2 | [--repo <url>] [--branch <name>] |
| 3 | |
| 4 | Brings the installed valley up to the tip of a branch of the-valley, for a |
| 5 | machine whose valley should follow that branch without a system rebuild. |
| 6 | It is off until a repository is named, by --repo or by the user's git |
| 7 | config, which is read whatever the current directory: |
| 8 | |
| 9 | git config --global valley.selfUpdate.repo git@<valley host>:the-valley |
| 10 | git config --global valley.selfUpdate.branch main (the default) |
| 11 | |
| 12 | repo is an https://, ssh://, git:// or file:// URL, an absolute path, or |
| 13 | user@host:path. user@host:path names what git itself would: a path that |
| 14 | starts with / or ~ as written, and any other path under the login's home, |
| 15 | read as ssh://user@host/~/path, which is how a valley host serves its |
| 16 | projects. Name a forge by its https:// or ssh:// URL. Any other transport |
| 17 | (ext::, fd::) and any character outside [A-Za-z0-9._~/:@-], which nix's |
| 18 | flake-ref parser would re-encode, is refused. git ls-remote and nix read the |
| 19 | repo by the same URL, and the git that self-update runs, directly or through |
| 20 | nix, is limited to those transports (GIT_ALLOW_PROTOCOL). Each run: |
| 21 | 1. takes a lock under $XDG_STATE_HOME/valley, so runs never overlap: a run |
| 22 | that finds another in progress exits 0 and says so; |
| 23 | 2. resolves the branch's commit with git ls-remote; |
| 24 | 3. exits 0 if the installed valley was built from that commit (quietly; |
| 25 | -v says so), or if that commit already failed to build or test (it is |
| 26 | retried when the branch moves, or with --retry); |
| 27 | 4. builds exactly that commit, the flake's packages.<system>.valley: |
| 28 | nix build 'git+<repo>?ref=refs/heads/<branch>&rev=<sha>#...'; |
| 29 | 5. smoke-tests the build, in an environment that carries nothing of the |
| 30 | running valley's: its valley --version must report the commit, its |
| 31 | valley help must exit 0, and its valley checks --names must derive |
| 32 | the expected checks from the tiny policy the package ships, which |
| 33 | shows the schema it carries composes a policy. A failure records the |
| 34 | commit as failed, installs nothing, and exits non-zero; |
| 35 | 6. installs it into the user's default nix profile in place of the |
| 36 | profile element named valley, leaving other elements alone. The system |
| 37 | valley stays underneath as the fallback; |
| 38 | 7. records the current and previous store paths and commits, the time and |
| 39 | any failure in $XDG_STATE_HOME/valley/self-update.json. |
| 40 | |
| 41 | Only the named branch installs, pinned to the commit ls-remote returned, |
| 42 | and only after it builds and passes the smoke test. Before self-update has |
| 43 | installed anything, the running valley's version (valley --version) says |
| 44 | which commit is installed. |
| 45 | |
| 46 | -v, --verbose also say so when valley is up to date |
| 47 | --retry build the branch's tip even if it failed before |
| 48 | --rollback reinstall the previous valley; again to return to the |
| 49 | newer one |
| 50 | --pin leave the current install alone until --unpin: runs while |
| 51 | pinned exit 0 with a note, so a bad tip is not reinstalled |
| 52 | while it gets fixed |
| 53 | --unpin let self-update install the branch's tip again |
| 54 | --repo URL the repository, in place of valley.selfUpdate.repo |
| 55 | --branch NAME the branch, in place of valley.selfUpdate.branch |
| 56 | |
| 57 | self-update [-v] [--retry | --rollback | --pin | --unpin] |
| 58 | [--repo <url>] [--branch <name>] |
| 59 | install the tip of a branch of the-valley into your |
| 60 | default nix profile, in place of its valley element, |
| 61 | once that exact commit builds and passes a smoke test. |
| 62 | a commit that fails is skipped until the branch moves, |
| 63 | or until --retry. it is off until --repo or |
| 64 | git config valley.selfUpdate.repo names the |
| 65 | repository; the branch is valley.selfUpdate.branch, |
| 66 | or main. --rollback reinstalls the previous build, and |
| 67 | --pin and --unpin freeze and release the install. |
| 68 | needs nix. |
| 69 | |
| 70 | --version print this valley's version: the package's version and |
| 71 | the commit it was built from, e.g. 0.1.0-97db597, with |
| 72 | -dirty after it for a tree with uncommitted changes and |
| 73 | -unknown in its place when nix knew no commit. built |
| 74 | without the package's stamp, it says it is unstamped. |