devkit
Shared devenv module: my personal dev tools (bug,
secrets, local-code-review), a jujutsu/bash toolchain, and the customized
interactive bash environment (fish-like completion, history search, etc.).
Importing devkit keeps every project’s shell identical and lets a single edit here propagate to all of them.
Use it in a project
devenv.yaml:
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling
# devenv#2205: an imported input's devenv.yaml is NOT evaluated, so the tool
# inputs must be declared here even though devkit wires the packages.
bug:
url: git+https://git.kilimanjaro.io/bug
local-code-review:
url: git+https://git.kilimanjaro.io/local-code-review
secrets:
url: git+https://git.kilimanjaro.io/secrets
devkit:
url: git+https://git.kilimanjaro.io/devkit
flake: false
imports:
- devkit
That’s the whole wiring. A project’s own devenv.nix only needs its
project-specific packages/env; devkit’s enterShell is concatenated with the
project’s.
Each tool is added only when its input is declared. Disable one with, e.g.,
devkit.bug.enable = false; in devenv.nix (used by a project that ships its
own wrapper, like sovrn).
Updating
Changes are pinned per project in devenv.lock:
devenv update devkit
For live, unpinned edits while iterating on devkit, temporarily point devkit.url
at a sibling clone (url: path:../devkit); edits then take effect on the next
devenv shell with no update.
New project scaffold
devenv init has no template flag (devenv #1718); its --from flag only
affects devenv shell/test/build. Use the Nix flake template instead:
mkdir ~/projects/newthing && cd ~/projects/newthing
nix flake init --refresh -t git+https://git.kilimanjaro.io/devkit
(Local clone: nix flake init -t path:/home/btburke/projects/devkit.)
--refresh picks up the latest template commit; without it nix reuses the
cached branch ref for tarball-ttl (default 1h). proj init always passes it.
Fish shell helper
fish/functions/proj.fish defines a proj function wrapping the scaffold:
proj init # scaffold in the current directory
proj init newthing # mkdir, cd, then scaffold
Install by symlinking into fish’s autoload directory (or wire it into your dotfiles):
mkdir -p ~/.config/fish/functions
ln -sf ~/projects/devkit/fish/functions/proj.fish ~/.config/fish/functions/proj.fish
Gotchas
- Not for the tool repos themselves (
bug,secrets,local-code-review): importing devkit there would be circular. - devkit’s own
devenv.yamlis only for standalone use in this directory; it is ignored when devkit is imported (devenv#2205).