Skip to content

flake: fix build with slang feature#328

Open
Smephite wants to merge 1 commit into
pulp-platform:masterfrom
Smephite:flake-slang-fix
Open

flake: fix build with slang feature#328
Smephite wants to merge 1 commit into
pulp-platform:masterfrom
Smephite:flake-slang-fix

Conversation

@Smephite

@Smephite Smephite commented Jul 3, 2026

Copy link
Copy Markdown

The slang feature (enabled by default) requires cmake and network access for FetchContent dependencies (slang, fmt, mimalloc), both unavailable in the nix sandbox. This breaks the flake build.

To support sandboxed builds without patching, build.rs now accepts optional env vars (SLANG_SRC_DIR, FMT_SRC_DIR, MIMALLOC_SRC_DIR). When set, they are forwarded as FETCHCONTENT_SOURCE_DIR_* cmake variables and used to derive include paths. Normal builds are unaffected — cmake still fetches everything when the vars are unset. This also simplifies the nixpkgs packaging in NixOS/nixpkgs#532944, which currently patches build.rs with replaceVars to achieve the same effect.

The flake is updated to use this mechanism: pre-fetched GitHub sources are passed via the env vars, cmake and python3 are added as build inputs, source filters are extended for C++/test files, NO_COLOR=1 is set for owo-colors test compatibility, and run_all.sh is run as an integration test.

@micprog micprog requested a review from fischeti July 3, 2026 14:50

@micprog micprog left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK to me, maybe @haflex wants to comment on the nix side?

@fischeti fischeti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in build.rs looks good to me. I don't have any experience for flake nix, but I trust you there :)

The question is whether this requires a new release of bender-slang. Does nix pull from crates.io? or does it just build from source?

@Smephite

Smephite commented Jul 3, 2026

Copy link
Copy Markdown
Author

Thanks guys!

The question is whether this requires a new release of bender-slang. Does nix pull from crates.io? or does it just build from source?

No release needed. bender-slang is a path dependency in Cargo.toml, so nix builds it directly from the source tree. It doesn't pull individual crates from crates.io as pre-built binaries; all dependencies are fetched as source via Cargo.lock and compiled from scratch inside the nix sandbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants