[M7] flake: distribution bundles + non-NixOS wrapper

This commit is contained in:
2026-05-17 12:29:30 +00:00
parent 1f63984b60
commit fdf97861a4
3 changed files with 311 additions and 4 deletions

View File

@@ -398,3 +398,40 @@ All notable changes to cargoxx will be documented in this file.
- Fix: `-Wparentheses` warning in `looks_like_missing_attribute`
(`src/resolver/nixpkgs_probe.cpp:34`) — explicitly parenthesize the
`&&` clause inside `||`.
- M7 `cargoxx-bin` wraps the binary with `makeWrapper` to lock its
runtime CLI dependencies — `nix`, `cmake`, `ninja`, `curl`, `git`
— onto `PATH`. Previously cargoxx silently relied on the user's
ambient PATH, so it broke whenever invoked outside a `nix develop`
shell. The wrapped binary works under `env -i` with a minimal PATH.
- M7 the wrapper also `--set-default`s `NIX_CONFIG` to
`experimental-features = nix-command flakes` and
`build-users-group =`. Without this, the bundled `pkgs.nix`
defaults to the multi-user daemon model and fails on non-NixOS
hosts (`error: the group 'nixbld' specified in 'build-users-group'
does not exist`). `--set-default` lets a user with a properly-
configured nix daemon override by exporting `NIX_CONFIG=...`
before invoking cargoxx. Verified end-to-end in `archlinux:latest`
via `docker run`: install the `.pkg.tar.zst`, `cargoxx new demo &&
cargoxx add fmt` runs the resolver chain through verify-link
cmake/ninja and writes the dep without error.
- M7 packaging functions exposed as a stable `to*` library and as
ready-to-build flake packages, mirroring the
`github:NixOS/bundlers` naming. Available as both
`packages.<format>` (for `nix build .#<format>`) and
`lib.to<Format>` (for downstream flakes to package their own
derivations):
- `toAppImage` / `packages.appimage` — Linux AppImage (~207 MB)
- `toDockerImage` / `packages.dockerImage``docker load`-able
tar.gz (~213 MB)
- `toDEB` / `packages.deb` — Debian `.deb` (~211 MB)
- `toRPM` / `packages.rpm` — Red Hat `.rpm` (~212 MB)
- `toArchPkg` / `packages.archpkg` — Arch `.pkg.tar.zst`
(~196 MB), implemented locally because no NixOS bundler exists.
Builds a closure via `pkgs.closureInfo`, lays it under
`/nix/store`, drops a `/usr/bin/<mainProgram>` symlink, writes
`.PKGINFO` from `drv.pname`/`drv.version`/`drv.meta`, and packs
with `bsdtar --zstd`. Generic — works for any derivation with
a `bin/<mainProgram>` and the usual `pname`/`version` attrs.
Added `inputs.bundlers.url = "github:NixOS/bundlers"` (with
`inputs.nixpkgs.follows = "nixpkgs"`) to keep the closure aligned
with the project's pinned nixpkgs.