Correct two nix.md claims against measurement #40

Open
allod-agent wants to merge 2 commits from agent/nix-git-https-credentials into master
Member

Two corrections to nix.md, both from measurements taken this session, both in the same file. Each one changed a decision while it was being made, which is why they are worth recording rather than left as session knowledge.

1. How Nix fetches git+https:// flake inputs

Memory said those go through libgit2, which reads ~/.netrc for the calling user. That is wrong for the Nix we pin, and the error hides the only route a guest without a writable home has.

Measured on Nix 2.31.5 with a PATH shim in front of git, fetching a public git+https flake:

git ls-remote --symref https://github.com/NixOS/patchelf
git -C ~/.cache/nix/gitv3/<hash> --git-dir . fetch --quiet --force -- https://… refs/heads/master:refs/heads/master
git -C ~/.cache/nix/gitv3/<hash> --git-dir . symbolic-ref -- HEAD refs/heads/master

Nix runs the git binary as a subprocess. So those fetches resolve credentials through git's own credential chain, which means a git credential helper is a supported way to authenticate a private HTTPS flake input — nothing in the previous text suggests that, and an agent reasoning from libgit2 concludes a per-user ~/.netrc is the only option.

That is load-bearing now: the microVM credential arc moves guests onto a tmpfs root with no persistent home to hold ~/.netrc, and the credential-delivery plan rewires the system and user Git credential helpers instead.

Deliberately narrow. Whether git additionally consults ~/.netrc through curl was not tested, and the text says so rather than guessing. The three-file layout stays recorded as the libvirt path known to work; only its attribution to libgit2, and the implication that it is the only route, are corrected.

2. One peak RSS measurement proves nothing about a tree

Measured on one unchanged check, three consecutive nix build --no-eval-cache runs on an otherwise idle box: 4.85, 4.38, 3.63 GiB. A 1.2 GiB spread with nothing varying but the run, falling monotonically as the page cache filled.

The evaluator's collector sizes its heap against the memory the box has free, so peak RSS is a property of the tree and the machine's state, anti-correlated with load — the same mechanism as the existing GC_MAXIMUM_HEAP_SIZE warning, with free memory acting as the implicit bound. A single run per tree cannot resolve a half-gigabyte change in either direction, which is enough to make a naive before/after comparison noise.

The entry also separates allocation from peak: a read that is consumed and dropped can add a lot of total work and none of the peak. Costing one at "~0.5 GB" says what it allocates, not what removing it would save. Getting that backwards sent this session chasing a phantom gigabyte before the measurement caught it.

This matters immediately for allod/archetypes#31, whose per-slice growth figures and whose case for landing before the credentials slice both rest on peak comparisons whose repeatability has not been established.

Risk

R0. One topic file in the memory repo, no runtime or generated behaviour, straight revert.

The residual risk is over-correcting. Both entries are scoped to what was measured and say what was not: the netrc question is left explicitly open, and no claim is made about Nix versions other than the pinned 2.31.5.

Validation

Both measurements are reproducible and described in the entries themselves. For the fetch mechanism: put a logging wrapper for git first on PATH, clear ~/.cache/nix/gitv3, run nix flake metadata git+https://… --refresh. A public repository was used, so no credential was involved. For the variance: three consecutive \time -v nix build --no-link --no-eval-cache runs of one check on a quiet box.

Not validated: whether git consults ~/.netrc via curl, and whether the whole-flake metric is better behaved than the single-check one — it spanned only 6.45-6.56 GiB across three runs in separate work, which is suggestive but was not the subject of this measurement.

Refs allod/strategy#20

Two corrections to `nix.md`, both from measurements taken this session, both in the same file. Each one changed a decision while it was being made, which is why they are worth recording rather than left as session knowledge. ### 1. How Nix fetches `git+https://` flake inputs Memory said those go through libgit2, which reads `~/.netrc` for the calling user. That is wrong for the Nix we pin, and the error hides the only route a guest without a writable home has. Measured on Nix 2.31.5 with a PATH shim in front of `git`, fetching a public `git+https` flake: ``` git ls-remote --symref https://github.com/NixOS/patchelf git -C ~/.cache/nix/gitv3/<hash> --git-dir . fetch --quiet --force -- https://… refs/heads/master:refs/heads/master git -C ~/.cache/nix/gitv3/<hash> --git-dir . symbolic-ref -- HEAD refs/heads/master ``` Nix runs the `git` binary as a subprocess. So those fetches resolve credentials through git's own credential chain, which means **a git credential helper is a supported way to authenticate a private HTTPS flake input** — nothing in the previous text suggests that, and an agent reasoning from libgit2 concludes a per-user `~/.netrc` is the only option. That is load-bearing now: the microVM credential arc moves guests onto a tmpfs root with no persistent home to hold `~/.netrc`, and the credential-delivery plan rewires the system and user Git credential helpers instead. **Deliberately narrow.** Whether git additionally consults `~/.netrc` through curl was *not* tested, and the text says so rather than guessing. The three-file layout stays recorded as the libvirt path known to work; only its attribution to libgit2, and the implication that it is the only route, are corrected. ### 2. One peak RSS measurement proves nothing about a tree Measured on one unchanged check, three consecutive `nix build --no-eval-cache` runs on an otherwise idle box: **4.85, 4.38, 3.63 GiB**. A 1.2 GiB spread with nothing varying but the run, falling monotonically as the page cache filled. The evaluator's collector sizes its heap against the memory the box has free, so peak RSS is a property of the tree *and* the machine's state, anti-correlated with load — the same mechanism as the existing `GC_MAXIMUM_HEAP_SIZE` warning, with free memory acting as the implicit bound. A single run per tree cannot resolve a half-gigabyte change in either direction, which is enough to make a naive before/after comparison noise. The entry also separates allocation from peak: a read that is consumed and dropped can add a lot of total work and none of the peak. Costing one at "~0.5 GB" says what it allocates, not what removing it would save. Getting that backwards sent this session chasing a phantom gigabyte before the measurement caught it. This matters immediately for `allod/archetypes#31`, whose per-slice growth figures and whose case for landing before the credentials slice both rest on peak comparisons whose repeatability has not been established. ## Risk R0. One topic file in the memory repo, no runtime or generated behaviour, straight revert. The residual risk is over-correcting. Both entries are scoped to what was measured and say what was not: the netrc question is left explicitly open, and no claim is made about Nix versions other than the pinned 2.31.5. ## Validation Both measurements are reproducible and described in the entries themselves. For the fetch mechanism: put a logging wrapper for `git` first on `PATH`, clear `~/.cache/nix/gitv3`, run `nix flake metadata git+https://… --refresh`. A public repository was used, so no credential was involved. For the variance: three consecutive `\time -v nix build --no-link --no-eval-cache` runs of one check on a quiet box. Not validated: whether git consults `~/.netrc` via curl, and whether the whole-flake metric is better behaved than the single-check one — it spanned only 6.45-6.56 GiB across three runs in separate work, which is suggestive but was not the subject of this measurement. Refs allod/strategy#20
The claim that git+https goes through libgit2 reading ~/.netrc is wrong
for the pinned Nix. Measured on 2.31.5 with a PATH shim: it runs the git
binary as a subprocess — ls-remote --symref, then fetch into the gitv3
cache, then symbolic-ref.

The consequence is the part that matters. Those fetches resolve
credentials through git own credential chain, so a git credential helper
is a supported route to authenticating a private HTTPS flake input. The
libgit2 story hides that, and a guest with no writable home has no other
way to do it.

Not tested, and stated as untested rather than guessed: whether git also
consults ~/.netrc through curl. The three-file layout stays recorded as
the libvirt path that is known to work.
Measured on one unchanged check, three consecutive builds on an idle
box: 4.85, 4.38, 3.63 GiB. A 1.2 GiB spread with nothing varying but
the run, falling monotonically as the page cache filled.

The evaluator collector sizes its heap against free memory, so peak RSS
is a property of the tree and the machine state together, and is
anti-correlated with load. A single run per tree cannot resolve a half
gigabyte in either direction, which is enough to make a before/after
comparison built that way pure noise.

Also separate allocation from peak. A read consumed and dropped can add
a lot of total work and none of the peak, so costing one at ~0.5 GB says
what it allocates, not what removing it would save. Getting this wrong
sent this session chasing a phantom gigabyte.
allod-agent changed title from Correct how Nix fetches git+https flake inputs to Correct two nix.md claims against measurement 2026-08-01 07:05:12 +01:00
vnprc left a comment

cut the prose by at least 50% and open an issue to review all memory files for excessive length, this is getting out of hand

cut the prose by at least 50% and open an issue to review all memory files for excessive length, this is getting out of hand
vnprc force-pushed agent/nix-git-https-credentials from 1b0f0d152d to 4c8ed35ca2 2026-08-04 22:44:25 +01:00 Compare
nix.md Outdated
@ -25,3 +25,1 @@
- `/etc/nix/netrc` (640, root:users) - nix daemon via `netrc-file` in nix.conf
- `/root/.netrc` (600, root:root) - libgit2 when root runs nix
- `/home/${username}/.netrc` (600, user:users) - libgit2 when the user runs `nix flake update`
Nix 2.31.5 fetches those by running the **`git` binary as a subprocess**, not through libgit2. Measured with a PATH shim: `git ls-remote --symref <url>`, then `git -C ~/.cache/nix/gitv3/<hash> --git-dir . fetch --force -- <url> <refspec>`, then `symbolic-ref`. So a `git+https://` input authenticates through **git's own credential chain, and a git credential helper is a supported route** — the thing the libgit2 story hides. Whether git additionally consults `~/.netrc` through curl was not tested; do not assume either way.
Owner

either cut this paragraph by 80% or delete it

either cut this paragraph by 80% or delete it
nix.md Outdated
@ -86,6 +90,10 @@ Exposing a second system multiplies nothing by default: `nix flake check` skips
Checks that build NixOS fixtures cost the same as a machine, so a framework repo's own check run climbs with fixture count, not machine count: `allod/archetypes` peaks around 5.7 GiB against a 7 GiB box with no swap, and the margin has been measured at ~840 MiB. Hold sabotage fixtures as thunks consumed one at a time rather than a list forced together — keeping a dozen live is an OOM kill, and the difference is over a gigabyte. A fixture that only needs an option value costs far less than one whose `system.build.toplevel` is forced, so force deliberately: forcing is what runs the module assertions, and skipping it is what makes a check vacuous.
**One peak measurement proves nothing about a tree.** The evaluator's collector sizes its heap against the memory the box has free, so peak RSS is a property of the tree *and* the machine's state, anti-correlated with load. Measured on one unchanged check, three consecutive `nix build --no-eval-cache` runs on an idle box: 4.85, 4.38, 3.63 GiB — a 1.2 GiB spread, falling monotonically as the page cache filled. So a single run per tree cannot resolve a half-gigabyte change in either direction, and a before/after comparison built that way is noise. Interleave repeated runs and report the spread, or gate the expensive read behind a flag and compare it against itself. This is the same mechanism as the `GC_MAXIMUM_HEAP_SIZE` warning: free memory acts as an implicit bound, and under a bound the collector simply works harder.
Owner

these two pgphs also read as a waste of time. delete them or cut to the bone

these two pgphs also read as a waste of time. delete them or cut to the bone
vnprc force-pushed agent/nix-git-https-credentials from 4c8ed35ca2 to 19722b17f7 2026-08-18 00:56:28 +01:00 Compare
vnprc force-pushed agent/nix-git-https-credentials from 19722b17f7 to 3902303a33 2026-08-19 18:30:53 +01:00 Compare
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin agent/nix-git-https-credentials:agent/nix-git-https-credentials
git switch agent/nix-git-https-credentials

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff agent/nix-git-https-credentials
git switch agent/nix-git-https-credentials
git rebase master
git switch master
git merge --ff-only agent/nix-git-https-credentials
git switch agent/nix-git-https-credentials
git rebase master
git switch master
git merge --no-ff agent/nix-git-https-credentials
git switch master
git merge --squash agent/nix-git-https-credentials
git switch master
git merge --ff-only agent/nix-git-https-credentials
git switch master
git merge agent/nix-git-https-credentials
git push origin master
Sign in to join this conversation.
No description provided.