builder.pl reads all configuration from %ENV, which is fundamentally
incompatible with __structuredAttrs = true (values go into a JSON file
instead). Explicitly opt out so buildEnv doesn't break when
structuredAttrsByDefault is enabled.
The override is placed in the final merge block so it cannot be
circumvented via derivationArgs.
Update the structuredAttrs test from asserting build failure to
verifying that the override works: the build succeeds even when
derivationArgs.__structuredAttrs = true, and eval tests confirm the
attribute is always false.
Suggested-by: Sietse Ringers <SFrijters>
Verifies that buildLakePackage works with nix-only deps (no
lake-manifest.json). Builds a proof of the weak minimax inequality
from Mathlib.Order.CompleteLattice.Basic using leanDeps = [ mathlib ].
By default it will look for the cred names supported by the upstream package, but alternate cred names can be chosen to produce a rename on the ImportCredential.
buildEnv's builder.pl reads all inputs from environment variables,
which is incompatible with structuredAttrs (values go into a JSON file
instead). Document this known failure as a test.
Add derivations that actually build a buildEnv and verify the output tree.
Exposed as passthru.buildTests so they can be built individually or all at once.
- basic-symlinking: single package produces correct symlink structure
- pathsToLink: only specified subdirectories appear in output
- extraPrefix: output is rooted under the specified prefix
- postBuild: shell commands execute after the symlink tree
- ignoreCollisions: duplicate paths succeed when ignoreCollisions=true
Verify that:
- derivationArgs attributes reach the underlying mkDerivation (tested via allowSubstitutes overriding the default false)
- The backward-compat layer for top-level nativeBuildInputs still works (these are forwarded through compatArgs)
buildEnv merges passthru from three sources:
`{ inherit paths; } // derivationArgs.passthru // passthru`
Verify that:
- Auto-injected paths are present in passthru
- derivationArgs.passthru attributes are preserved
- Direct passthru attributes are preserved
- Direct passthru takes precedence over derivationArgs.passthru
Verify that overrideAttrs on a buildEnv result:
- Can modify passthru attributes
- Preserves the derivation name
- Produces a different derivation when a build-affecting attribute (postBuild) is changed
This is the core new capability of the PR: `buildEnv` now accepts a function `(finalAttrs: { ... })` enabling self-referencing attributes.
Verify that finalAttrs.name is accessible from within the argument function.
buildEnv stashes `paths` into `passthru.paths` (rather than passing it directly as a derivation attribute) to prevent unexpected string context pollution. Verify that:
- paths are accessible via passthru.paths
- passthru.paths can be overridden with overrideAttrs
Verify that:
- `name` argument is used directly as the derivation name
- `pname` + `version` composes into the derivation name
- Omitting all three triggers the buildEnv-specific assertion
The assertion test uses `builtins.tryEval` + `builtins.seq` to force evaluation of .drvPath and confirm it throws.
Add an eval-time test harness for buildEnv following the pattern established by `tests.overriding`.
Uses `lib.runTests` to compare expr/expected pairs, and the buildCommand reports pass/fail.
No tests yet; subsequent commits add them individually.
This was an oversight in https://github.com/NixOS/nixpkgs/pull/478539
that became apparent in https://github.com/NixOS/nixpkgs/pull/494416:
If there's a failing problem in Nixpkgs packages, CI will call
handleEvalIssue on it, but the problem error was missing a `.reason`.
Though even if it did have a reason, we need to do more to make sure
we don't break any code that uses it, so the new code uses the problem
kind as the reason, which happens to match with the reason for all
expected problem kinds.
other sections may include code that doesn't originate from
the compiler under test or may not obey flags in the same
way.
this should fix our pacret-detecting tests.
This logs when there was a missing dependency that was matched by an
ignore pattern.
The test case is extended to also check for having the IgnoredDependency
events in the structured log output.
This adds a test for the --structured-log feature of auto-patchelf.
When auto-patchelf'ing ToneLib-Jam and only making freetype available,
we expect:
- one "SetInterpreter" line
- 3 "Dependency" lines (of which one found)
- one SetRpath line (containing freetype)