fix(nix): make flake checks hermetic#1958
Closed
elezar wants to merge 18 commits into
Closed
Conversation
Add crane-based package outputs for the main OpenShell crates and a default symlinkJoin package. The new workspace helper derives each crate's transitive workspace dependency closure, builds from minimal source trees, and declares the assets each crate needs at compile time. Build each crate in three layers: 1. crates.io dependencies with crane buildDepsOnly 2. first-party workspace dependency libraries 3. the final real crate The workspace-libs layer builds the selected package with the same `-p <crate>` selection as final so Cargo feature unification matches, but overlays a crane-generated dummy source for the leaf crate. After that layer builds, remove the dummy leaf artifacts with `cargo clean --release -p <crate>` so the final layer cannot reuse or package stub outputs. This lets leaf edits reuse cached first-party libs while still compiling and linking the real leaf crate. Add explicit `[lib]` target names and `path = "src/lib.rs"` entries to workspace crates. The Nix source minimizer keeps every member Cargo.toml but omits source trees outside the selected crate closure; explicit target paths let Cargo resolve those member manifests without relying on auto-discovery of files that are intentionally absent. They also give crane's dummy source generation a stable target shape. Guard the openshell-core build script's `.git` rerun paths so Cargo does not mark core dirty in Nix source trees where `.git` is absent. Without this, core recompiled in the final layer and cascaded into its dependents. Known limitation: the VM driver package is wired into the flake, but the Nix build does not yet provide the compressed VM runtime artifacts that openshell-driver-vm embeds. For now that crate builds via its stub-resource fallback rather than producing a fully usable VM driver package. Ignore Nix `result*` symlinks created by local builds.
Signed-off-by: Simon Scatton <sscatton@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Member
Author
PR Review StatusValidation: this maintainer-authored PR is project-valid because it is a concentrated Nix/check hermeticity and VM runtime socket-path fix. Review findings:
Docs: no Fern docs update is required; this is build hermeticity and internal runtime path hardening. Next state: |
adf92e7 to
eab1d5e
Compare
Member
Author
Monitoring CompleteMonitoring is complete because this PR has been closed without merge. Final status: the PR closed with an active I removed the active |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make
nix flake checkpass on the Darwin builder by removing two host-environment assumptions exposed by hermetic Nix checks.Related Issue
None.
Changes
lsoftoopenshell-coreNix check inputs because the port availability test asserts cross-family listener detection throughlsof./tmp/osd-gvto per-user/tmp/openshell-<uid>/osd-gvwhenXDG_RUNTIME_DIRis absent, preserving ownership checks while avoiding cross-user temp-dir collisions.Context
On this system,
lsofexisted on the host at/usr/sbin/lsof, but it was not present inside the Nix test derivation. The production port check treats missinglsofas no listener data, so the IPv6 wildcard listener test failed untilpkgs.lsofwas declared.The VM driver also fell back to
/tmp/osd-gv. In the Nix sandbox that directory already existed with uid 502, while the builder ran as uid 355. The existing ownership guard correctly rejected it. Using a uid-scoped fallback keeps the safety property and makes the path hermetic for multi-user and Nix builds.Testing
nix build .#checks.aarch64-darwin.openshell-core-test --print-build-logsnix build .#checks.aarch64-darwin.openshell-driver-vm-test --print-build-logsnix build .#checks.aarch64-darwin.rustfmt --print-build-logsnix build .#checks.aarch64-darwin.openshell-driver-vm-clippy --print-build-logsnix flake checkmise run pre-commitpasses:miseis unavailable in this shell (zsh: command not found: mise)Checklist