You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Devbox's package syntax expects a flake, which makes it awkward to
consume a locally-authored .nix expression (e.g. a `default.nix`
written with `pkgs.callPackage`). Today users have to hand-write a
boilerplate wrapper flake before they can reference the directory as
`"./my-pkg": ""` or `"path:./mypackage"` in devbox.json.
This adds a new `devbox generate flake-wrapper [path]` command that
scaffolds that wrapper for them:
- New `internal/devbox/flakegen` package renders a small embedded
template (`flake-wrapper.nix.tmpl`) that imports a target .nix
file via `pkgs.callPackage` and exposes it under
`packages.${system}.<attr>`.
- `boxcli` wires it up as a subcommand of `generate` with flags for
`--force`, `--nixpkgs`, `--attr`, and `--print`. When run inside a
devbox project the command defaults `--nixpkgs` to the project's
stdenv so the wrapper stays in sync; otherwise it falls back to
`nixpkgs-unstable`. The subcommand skips the parent `generate`
command's ensureNixInstalled hook since it is pure text templating.
- Adds unit tests for `flakegen` (template rendering, path
resolution, `--force`, `--print`) and a CLI-level test for the new
subcommand.
- Adds an `examples/nix/hello` example showing the end-to-end flow.
Closes#2717
0 commit comments