Repository navigation
Description
pyterm moved to one repository on 2026-10-14. Its sources are now directories, and josh exports each one to its own repository on every push. This is the route it took and the traps it hit, so that nixidae can take the same route. Every file named below is in Lillecarl/pyterm at main. Copy from there, do not start from scratch. The pyterm issues are Lillecarl/pyterm#669 (the import), Lillecarl/pyterm#672 (standalone sources) and Lillecarl/pyterm#673 (docs sites).
0. Settle the shape with Carl first
pyterm's answers, as a starting point:
- Which repositories go in. A fork whose patches must stay upstreamable (pyterm's prompt-toolkit) stays out. Its checkout sits in the tree, gitignored, and
flake.lockpins it.nix/compat.nixpasses flake-compatishoverrides = { self = ../.; prompt-toolkit = ../prompt-toolkit; }. Theselfoverride is required for pure evaluation. - The export target repositories are export-only. Commits happen in the monorepo, and issues go in one tracker.
- Tests run only in the monorepo. Each exported repository runs one workflow, its Pages deploy (see step 6).
- The credential is a fine-grained PAT, stored as the monorepo secret
JOSH_EXPORT_TOKEN.
1. Import without losing history (do it in a separate clone)
- Merge each source in with josh
:prefix=<dir>. The export filter:/<dir>then gives back the same commit hashes that each repository already has. That is why every later push fast-forwards. - Stage it on a branch, for example
monorepo, and push each export to ajoshbranch in each target first. Compare that branch with the target'smain, and only then movemain. - Archive before you move anything. Copy each remote branch to
archive/pre-josh/<branch>. Push commits that exist only locally (jj log -r 'remote_bookmarks()..'and orphans) asarchive/pre-josh/unpushed-*. Keep the archives, thejoshbranches and the old checkout until Carl removes them. - To rename master to main, use
gh api -X POST repos/O/R/branches/master/rename -f new_name=main. Trap: the rename leaves the repository'sgithub-pagesenvironment branch policy onmaster, so the next Pages deploy fails. Repoint it withgh api repos/O/R/environments/github-pages/deployment-branch-policies. - Do the whole export locally, with your own push access, before you automate it. "What would GHA do" is cheaper to answer from your own terminal.
2. One lock, nothing flake-only
- The root
flake.lockis the only pin. npins goes.default.nixtakes{ inputs ? compat.inputs, system, pkgs ? <pinned>, sourceOverrides ? { } }. flake.nixonly mapsdefault.nixover the systems. Nothing is defined there.
3. Each source builds alone
pyterm's nix/shared/ holds the templates, with @name@ for the name. Each source has:
package.nix: the package that the root calls.default.nix:import inputs.pyterm { inherit (inputs.pyterm) inputs; system; sourceOverrides.<name> = ./.; }, which passespkgsthrough when given. It exposes<name>,default,shell,checksandpages.flake.nixwith a single input, the monorepo.nix/compat.nix, which reaches flake-compatish two hops through the lock. Alsoshell.nix.flake.lock, written bypkgs/lock-subtrees. The lock is the root's lock graph plus a monorepo node locked at HEAD. Take the narHash from a localfetchTreeof the git repository; it equals GitHub's. A commit cannot name itself, so the locks land as a second commit after the content.--check REVrefuses a lock that names a commit with anything but locks changed since.
4. The export
pkgs/josh-export(Python,writePython3Bin) finds sources by tracked*/flake.nix. It never forces a push, and it refuses a target that moved on its own.--verifyrequires each exported tree's standalone drvPath to equal the monorepo's. josh comes from the pinned nixpkgs, so after a nixpkgs bump runjosh-export HEAD --verifybefore the push: another josh version can produce other hashes..github/workflows/josh-export.ymlruns on a push to main:lock-subtrees --check "$GITHUB_SHA", thenjosh-export "$GITHUB_SHA" --verify --push.- Trap:
actions/checkoutneedspersist-credentials: falseandfetch-depth: 0. Without the first, the push goes as github-actions[bot] and is refused. - Trap: the PAT needs Contents read/write and Workflows read/write on every target. Without Workflows, GitHub refuses a push that creates a workflow file ("refusing to allow a Personal Access Token to create or update workflow"). A push that only deleted one went through, which hid the gap.
5. Landing procedure (put it in CLAUDE.md)
jj commit, then nix run --file . lock-subtrees, then jj bookmark set main -r @-, then jj git push --bookmark main. Then read the export run.
6. Docs sites
nix/docs/builds each source's site with Sphinx, MyST, furo and an autosummary API reference. The content is the source's README, itsdocs/and the API. Each pyproject has adocsextra, so autodoc imports the real package.- Each source's
pagesattribute is deployed by its exported.github/workflows/pages.yml. The root'spages.<root>gathers every source's site under/<name>/. Anything slow (pyterm's 30-minute picture galleries) builds only in the repository that owns it, and the root links to it. - Trap:
configure-pageswithenablement: truecannot create a Pages site with the run's own token ("Resource not accessible by integration"). Enable it once per repository withgh api -X POST repos/O/R/pages -f build_type=workflow, then rerun.
7. Keep the sources alike
pkgs/sync-sources writes what every source shares from the root:
- the
[tool.ruff]stanza, fromruff.toml; .gitignore,default.nix,shell.nix,nix/compat.nixandpages.yml, fromnix/shared/;- the README's head and tail, found by HTML-comment marker lines.
checks.<root>-sources-in-step, part of the gate, fails while a copy drifts. Seven hand-kept copies had drifted before this existed.
Checked in pyterm
nix run github:Lillecarl/pymuxworks.nix flake check --all-systemspasses.- A fresh clone builds with
--file. - The standalone drv equals the monorepo's (
--verify).
Activity
Lillecarl commentedon Oct 14, 2026
Shape settled with Carl on 2026-10-14:
:prefix=<name>.main. nanopynix, pynixd, easykubenix, nixkube, vivarium and ghanix renamedeveloptomainfirst.Assisted-By: Claude Opus 5.5
Lillecarl commentedon Oct 14, 2026
Staged locally in a separate clone (branch
monorepo, nothing pushed). Each step is a commit; 40 of them on top of b8b1292.:prefixmerges.josh-filter :/<name>gives back each repository's exact remote head, signed commits included.flake.lock(allflake = false, flat), read bynix/compat.nix. Sources are what git tracks of each directory, copied to a store path namedsource, so local, CI and exported builds agree. Old umbrella vs new: 149 of 168 top-level derivations identical; the 19 that differ are in sources I edited.sourcesand silently fetched an older nixidae (nixkube wait_for matches what already arrived, so a repeated expectation checks nothing Lillecarl/pyterm#81's bug class). Fixed.ciTestWorkflows;nix/ci.nixrenders.github/workflows/<source>-<name>.yml. Exported repos keep only a Pages workflow (vivarium none).lock-subtreesandjosh-exportadapted from pyterm, with per-source repo targets innix/members.nix.josh-export HEAD --verify: all nine ok, standalone drv == root drv. Both checks fail when they should (tested).Open for Carl: the cutover pushes, the
JOSH_EXPORT_TOKENPAT, where nixkube releases live (tags are nownixkube/v*), andnanopynix/last-greennow on nixidae.Assisted-By: Claude Opus 5.5
Lillecarl commentedon Oct 14, 2026
Cut over 2026-10-14.
main= 6a2b054. Every childmainfast-forwarded to its josh export (no force). vivarium and ghanix:developrenamed tomain. nanopynix, pynixd, easykubenix, nixkube: default branchmain; theirdevelopstays where it was. github-pages branch policies point atmain.archive/pre-josh/*in every child: 29 old branches, 9 formerly local-only commits.nixkube/vXhere releasesvXthere, on the exported commit.JOSH_EXPORT_TOKEN. A fine-grained PAT covers one owner, and the targets are Lillecarl/* plus nixidae/havsorm. Until it exists, the export job fails at its push step.Assisted-By: Claude Opus 5.5