modules/programs/agents/shared/_archive/init-flake-package/SKILL.md
Add bun2nix packaging to an existing flake
npx skillsauth add MichaelVessia/nixos-config init-flake-packageInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Convert a devShell-only flake to a deployable package using bun2nix.
flake.nix with devShellbun.lock file (run bun install first)src/main.ts or src/index.ts)Detect project info:
src/main.ts, src/index.ts, or askGenerate bun.nix:
nix run github:nix-community/bun2nix
Replace flake.nix with packaging version:
{
description = "<project-name>";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
bun2nix = {
url = "github:nix-community/bun2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
flake-utils,
bun2nix,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
bun2nix' = bun2nix.packages.${system}.default;
in {
packages.default = pkgs.stdenv.mkDerivation {
pname = "<pname>";
version = "<version>";
src = ./.;
nativeBuildInputs = [
bun2nix'.hook
pkgs.makeBinaryWrapper
];
bunDeps = bun2nix'.fetchBunDeps {
bunNix = ./bun.nix;
};
# Run with bun interpreter (not AOT compiled)
dontUseBunBuild = true;
dontUseBunCheck = true;
dontUseBunInstall = true;
installPhase = ''
runHook preInstall
mkdir -p $out/lib/<pname>
cp -r . $out/lib/<pname>
mkdir -p $out/bin
makeBinaryWrapper ${pkgs.bun}/bin/bun $out/bin/<pname> \
--add-flags "run $out/lib/<pname>/<entry-point>"
runHook postInstall
'';
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
bun
typescript
lefthook
bun2nix'
];
shellHook = ''
echo "<project-name> dev shell"
echo " bun2nix - Regenerate bun.nix after lockfile changes"
'';
};
});
}
Add to .gitignore (if not present):
result
Test the build:
nix build
./result/bin/<pname>
Summary: Note that bun2nix must be re-run after lockfile changes
development
Restate the last message in plain human language, with no jargon.
testing
Fan out a batch of work items into one PR each via isolated worktree agents, review every PR before it opens, then babysit all PRs through green CI and review feedback. Use when the user wants to fan out PRs, dispatch parallel PR agents over a list of items, or run a batch of independent changes as separate PRs.
development
Dispatch user-visible coding or research agents through Herdr with Codex-Desktop-like thread ergonomics. Use when the user asks to use Herdr to spawn, dispatch, fan out, inspect, follow up with, or monitor agent workspaces/threads.
development
Generate self-contained HTML visualizations with Plannotator theming. Use for implementation plans, PR explainers, architecture diagrams, data tables, slide decks, and any visual explanation of technical concepts. Plans and PR explainers follow Plannotator's prescriptive approach; all other visual content delegates to nicobailon/visual-explainer.