Activation & the devshell¶
Entering the checkout should just work — no manual nix develop, no
environment fiddling. Here is the machinery that makes that true.
The chain¶
cdinto the checkout fires direnv's shell hook.- direnv sources the symlinked
.envrc(which points intoqgis-dev-env/overlay/envrc). It resolves the sidecar location from its own symlink target, so it works for any clone path and any worktree, and exportsCCACHE_DIR,QGIS_DEV_SIDECARand a UTF-8LANG. use flake path:<sidecar> --override-input qgis "git+file://<qgis root>" --impurerealisesdevShells.default, withqgispointed at this real checkout instead of the flake's committedgithub:qgis/QGISpin (see The flake for why that's an invocation-timegit+file:override rather than a declared input). The result is cached by nix-direnv, so only the first activation (or one after a watched file changes) does real work.- The flake's
shellHookexports the resolved Qt plugin roots, the QML import path, the PyQGIS interpreter and the report-template store path — all computed at shell time, never committed as hard-coded store paths. .envrcsourceslib/shell-motd.sh, which prints the Kartoza banner with live data (branch, profile, ccache, last build).
Why the banner lives in .envrc, not only the shellHook¶
nix-direnv caches the shellHook's output, so a banner emitted only from
the hook would appear once per flake change, not per entry. .envrc runs
on every activation, so the banner is sourced there (guarded by a
process-local flag so the two paths don't double-print).
What triggers a re-evaluation¶
.envrc watch_files flake.nix, flake.lock and lib/tasks.sh — in
both the sidecar and the embedding QGIS checkout. A change to any of
those re-evaluates the devshell on your next entry (tasks.sh because it
is baked into the qgis-dev binary). Watching the QGIS-side pair is what
makes the qgis input self-updating: a plain git pull in the checkout
that changes QGIS's flake.nix (new WITH_* deps) or flake.lock
(bumped nixpkgs) is picked up automatically, no extra step — qgis-dev
sync (<leader>pU) only forces it immediately inside a session you
already have open. Profiles, suppressions and the banner are read live
and need no reload. Because path: flakes key on content hash, any
watched commit also prompts one quick re-evaluation — seconds when
nothing material changed.