Commit Graph

53 Commits

Author SHA1 Message Date
Aliaksandr
18e7551efc buildenv: replace // optionalAttrs with nullable attr names
Convert 2 optionalAttrs (args ? nativeBuildInputs, args ? buildInputs) in the compatArgs block into nullable attribute names in a single attrset.
2026-05-18 03:54:27 +03:00
Eman Resu
01d170164d buildEnv: use concatMap, avoid piping 2026-05-13 21:14:09 -04:00
Yueh-Shun Li
ed96bfd307 buildEnv: construct with structured attributes and pass chosenOutputs directly 2026-04-02 07:31:12 -07:00
Yueh-Shun Li
0efccf1dd9 buildEnv: remove redundant pname-version-name assertion
Delegate such a check to stdenv.mkDerivation.
2026-04-02 07:30:35 -07:00
Philip Taron
1b0981b3cb buildEnv: explicitly set __structuredAttrs = false
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>
2026-03-24 20:54:58 -07:00
Philip Taron
7269072659 buildEnv: fix passthru merging
Merge derivationArgs.passthru into the passthru chain so that passthru attributes passed via derivationArgs are not silently dropped.
2026-03-19 13:17:19 -07:00
Yueh-Shun Li
7e851e1cf5 buildEnv: take derivationArgs 2026-03-19 13:17:19 -07:00
Yueh-Shun Li
ae8cb8c65e buildEnv: reference attributes from finalAttrs 2026-03-19 13:17:19 -07:00
Yueh-Shun Li
726999375d buildEnv: construct with extendMkDerivation and stdenvNoCC.mkDerivation 2026-03-19 13:17:18 -07:00
Yueh-Shun Li
c42757764c buildEnv: specify extraPathsFrom a string as expected by the builder
Specify `extraPathsFrom` as a string using `lib.optionalString` instead of a singleton list using `lib.optional` to align with the current behavior of the Perl build script.
2026-03-19 13:17:18 -07:00
Connor Baker
19f546749c buildEnv: make name optional
Signed-off-by: Connor Baker <ConnorBaker01@gmail.com>
Co-authored-by: Yueh-Shun Li <shamrocklee@posteo.net>
2026-01-19 12:45:01 +01:00
Ivy Pierlot
fbe214434a buildEnv: change pathsToLink to json decoding 2025-10-15 11:15:29 +11:00
NAHO
c8d4dabc43 pkgs: remove optional builtins prefixes from prelude functions
Remove optional builtins prefixes from prelude functions by running:

    builtins=(
      abort
      baseNameOf
      break
      derivation
      derivationStrict
      dirOf
      false
      fetchGit
      fetchMercurial
      fetchTarball
      fetchTree
      fromTOML
      import
      isNull
      map
      null
      placeholder
      removeAttrs
      scopedImport
      throw
      toString
      true
    )

    fd \
      --type file \
      . \
      pkgs \
      --exec-batch sed --in-place --regexp-extended "
        s/\<builtins\.($(
          printf '%s\n' "${builtins[@]}" |
            paste --delimiter '|' --serial -
        ))\>/\1/g
      "

    nix fmt
2025-10-04 19:02:37 +02:00
Wolfgang Walther
a8f509677f various: replace substituteAll with replaceVars
Some easy ones.
2025-01-26 16:47:16 +01:00
Silvan Mosberger
667d42c00d treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev 57b193d8dd
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:27:17 +01:00
Yueh-Shun Li
70038f0e4d buildEnv: support ignoreSingleFileOutputs
Add option to ignore single-file output instead of failing.
2024-12-03 12:14:00 +08:00
jopejoe1
e37eeadacd buildenv: fix version not being set 2024-11-26 23:46:24 +01:00
jopejoe1
b497dfa184 bundler-{app,env}: expose pname and version in derivation 2024-11-15 23:57:00 +01:00
K900
f32ec5e6d7 buildenv: don't pass null paths to writeClosure 2024-09-19 23:09:26 +03:00
K900
4654ea4cc0 buildEnv: support pulling in closures of paths
This will become important for Steam.
2024-09-12 15:27:46 +03:00
Philip Taron
ae92f312bf treewide: use a consistent meta.priority default 2024-08-29 09:04:57 -07:00
adisbladis
dda7578745 build-support/buildenv: Hoist builder instantiation 2023-12-29 03:04:46 +13:00
Robert Hensing
fcea105698 buildEnv: Nix's buildEnv should be stable
It's mostly used by nix-env, but Nix should remain simple and small
for reproducibility.
2023-07-06 16:13:38 +02:00
pennae
dc895fb281 lib: make extendDerivation lighter on eval
the fix to extendDerivation in #140051 unwittingly worsened eval performance by
quite a bit. set elements alone needed over 1GB extra after the change, which
seems disproportionate to how small it was. if we flip the logic used to
determine which outputs to install around and keep a "this one exactly" flag in
the specific outputs instead of a "all of them" in the root we can avoid most
of that cost.
2021-10-15 16:39:10 +02:00
sternenseemann
b398d00903 trivial-builders: merge passAsFile with env in runCommand'
Previously it was awkward to use the runCommand-variants with
passAsFile as a double definition of passAsFile would potentially
break runCommand: passAsFile would overwrite the previous definition,
defeating the purpose of setting it in runCommand in the first place.
This is now fixed by concatenating the [ "buildCommand" ] list with
one the one from env, if present.

Adjust buildEnv where passAsFile = null; was passed in some cases,
breaking evaluation since it'd evaluate to [ "buildCommand" ] ++ null.
2021-03-18 19:56:40 +01:00
John Ericson
4f6ec19dbc buildEnv: Support nativeBuildInputs too
Since #112276, we should always put `makeWrapper` in
`nativeBuildInputs`. But `buildEnv` was saying put it in `buildInputs`.
That's wrong!

Fix the instructions, and make the right thing possible.
2021-03-02 22:34:54 +00:00
Vladimír Čunát
2adf954e84 Merge #55420: buildEnv, substituteAll: disable binary cache
... into staging.
2019-02-22 13:57:01 +01:00
Maximilian Bosch
9fcd3bffc2 buildEnv: improve file check to avoid false-positives
The original change in #55372 was supposed to fix the case where a store
path which is a file should be placed into `buildEnv` which broke with a
fairly misleading Perl error.

Unfortunately this introduced a regression, `findFiles` can have targets
that are files if the file isn't a store path. Rather than adding more
obscure checks with probably further regressions, I figured that it's
better to replicate the behavior of `lib.isStorePath` and explicitly
check if the store path is a file and break in this case only.

This should also fix recent staging issues.
2019-02-21 10:37:42 +01:00
volth
09665fee2b buildEnv: allowSubstitutes = false
trivial derivation
2019-02-07 22:19:26 +00:00
tilpner
77f1c7d5bc buildenv: Make buildEnv overridable
callPackage already calls makeOverridable, but that just
makes the function that evaluates to buildEnv overridable,
not buildEnv itself.
If no overridable version of buildEnv is used during construction,
users can't override e.g. `paths` at all
2017-08-02 11:56:37 +02:00
Eric Litak
bd45ec6416 buildEnv: use buildPackages.perl so crossDrv works 2017-04-14 02:00:08 -07:00
Vladimír Čunát
f57c6449dc buildEnv: fix #14682 evaluation in some edge cases
I supplied meta.outputsToInstall automatically in all
mkDerivation products, but some packages still don't use it.
The reported case: jekyll -> bundlerEnv -> buildEnv -> runCommand.
2016-04-17 08:57:17 +02:00
Vladimír Čunát
9a824f2f1d treewide: rename extraOutputs{ToLink,ToInstall}
This is to get more consistent with `meta.outputsToInstall`.
2016-04-07 15:59:44 +02:00
Vladimír Čunát
2995439003 buildEnv: respect meta.outputsToInstall
As a result `systemPackages` now also respect it.
Only nix-env remains and that has a PR filed:
    https://github.com/NixOS/nix/pull/815
2016-04-07 15:59:44 +02:00
Vladimír Čunát
d6b46ecb30 Merge branch 'closure-size' into p/default-outputs 2016-03-14 11:27:15 +01:00
Vladimír Čunát
ae74c356d9 Merge recent 'staging' into closure-size
Let's get rid of those merge conflicts.
2016-02-03 16:57:19 +01:00
Vladimír Čunát
ab8a691d05 nixos systemPackages: rework default outputs
- Now `pkg.outputUnspecified = true` but this attribute is missing in
  every output, so we can recognize whether the user chose or not.
  If (s)he didn't choose, we put `pkg.bin or pkg.out or pkg` into
  `systemPackages`.
- `outputsToLink` is replaced by `extraOutputsToLink`.
  We add extra outputs *regardless* of whether the user chose anything.
  It's mainly meant for outputs with docs and debug symbols.
- Note that as a result, some libraries will disappear from system path.
2016-01-28 11:24:18 +01:00
aszlig
4529ed1259 buildEnv: Check the content of colliding paths.
Originally wanted to include ignoreCollisions in cups-progs, but I think
it's better if we use ignoreCollisions only if there are _real_
collisions between files with different contents.

Of course, we also check whether the file permissions match, so you get
a collision if contents are the same but the permissions are different.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2016-01-18 03:54:22 +01:00
Luca Bruno
5b0352a6a4 Merge branch 'master' into closure-size 2015-12-11 18:31:00 +01:00
Luca Bruno
31ed92f65f Fix system-path with multiout 2015-12-01 15:09:41 +01:00
Tuomas Tynkkynen
74c09a6e64 buildEnv: Allow setting meta attributes 2015-11-29 19:13:19 +02:00
William A. Kennington III
1496b0f6a1 Fix buildenv 2015-10-30 18:09:45 -07:00
William A. Kennington III
dd2de66d61 Merge branch 'master.upstream' into staging.upstream 2015-10-30 17:16:07 -07:00
Eelco Dolstra
58e9440b89 Add option to link additional package outputs into system.path
This is necessary to get stuff like separate manpages, info files,
debug symbols, etc.
2015-10-30 15:21:02 +01:00
Nikolay Amiantov
d49140f3e4 buildenv: support very long paths 2015-10-22 15:35:39 +03:00
Vladimír Čunát
fa33b083eb buildEnv: add new parameters: extraPrefix and buildInputs 2015-09-17 17:43:18 +02:00
Eelco Dolstra
e4610f2965 buildEnv: Support package priorities like nix-env
This gets rid of a bunch of collision warnings.
2015-08-25 00:40:40 +02:00
Florian Friesdorf
84030ee1f0 buildEnv to support passthru 2014-07-10 16:41:02 +02:00
Eelco Dolstra
fa276c45dd * Set preferLocalBuild on a few more trivial builders.
svn path=/nixpkgs/trunk/; revision=33935
2012-04-26 15:17:43 +00:00
Eelco Dolstra
a2102af6df * buildEnv: use $SHELL (i.e. bash) rather than /bin/sh. This allows
NixOS VM tests to be built on Ubuntu, where /bin/sh is dash rather
  than bash.

svn path=/nixpkgs/trunk/; revision=24592
2010-11-03 22:37:00 +00:00