Commit Graph

16 Commits

Author SHA1 Message Date
Artturin
f9fdf2d402 treewide: move NIX_CFLAGS_COMPILE to the env attrset
with structuredAttrs lists will be bash arrays which cannot be exported
which will be a issue with some patches and some wrappers like cc-wrapper

this makes it clearer that NIX_CFLAGS_COMPILE must be a string as lists
in env cause a eval failure
2023-02-22 21:23:04 +02:00
Artturin
425e4250db tests.stdenv.outputs-no-out: fix 2023-02-22 21:23:04 +02:00
Artturi
e42cdd2383
Merge pull request #212286 from Artturin/runonall
make-symlinks-relative: run on all outputs
2023-01-25 15:51:53 +02:00
Artturin
cfb543a532 make-symlinks-relative: run on all outputs 2023-01-23 20:11:41 +02:00
Robert Hensing
01d7f19346 multi-outputs.sh: Improve _assignFirst error message
Closes #16182

This improves the error message

    Error: _assignFirst found no valid variant!

which occurred when the set of outputs was not sufficient to set
the various outputDev, outputBin, etc variables. Specifically, this
would mean that "out" is not among the outputs, which is valid for
a derivation.

This changes the message to something like

    error: _assignFirst: could not find a non-empty variable to assign to outputDev. The following variables were all unset or empty: dev out.
          If you did not define an "out" output, make sure to define all the specific required outputs: define an output for one of the unset variables.

While this isn't a full explanation of what stdenv can and can not do,
I think it's vast improvement over the 0 bits of information that it
used to provide. This at least gives a clue as to what's going on, and
even suggests a fix, although probably multiple such fixes are required
in an instance where someone starts with a no-out derivation from scratch
(and decide to persist).
2023-01-16 12:57:01 +01:00
Naïm Favier
84eebc0fe4
Merge pull request #205944 from ncfavier/structured-attrs-env 2022-12-15 13:27:54 +01:00
Artturin
9b1e8d7267
tests.stdenv: check that attrs in env are exported 2022-12-15 13:27:11 +01:00
Naïm Favier
e14de22618
stdenv: handle env gracefully
Derivations not using `__structuredAttrs` should not attempt to set
environment variables from `env`.

Derivations using `__structuredAttrs` should fail if `env` is not
exportable.
2022-12-15 13:27:11 +01:00
Artturin
630bb71ac5 stdenv: sort defaultNativeBuildInputs alphabetically 2022-12-13 01:12:20 +02:00
Artturin
60b1f09aa4 tests.stdenv.hooks: add more tests 2022-12-12 21:39:56 +02:00
Artturin
9cb5662187 tests: move stdenv hook tests to stdenv.hooks 2022-12-12 21:39:56 +02:00
Artturin
84a7cadfd2 tests.stdenv: add test-golden-example-structuredAttrs
examples copied from https://nixos.mayflower.consulting/blog/2020/01/20/structured-attrs/

nix has tests for structuredAttrs but i figured it'd be good to have a
golden test here too

https://github.com/NixOS/nix/blob/master/tests/structured-attrs.nix
https://github.com/NixOS/nix/blob/master/tests/structured-attrs-shell.nix
2022-12-12 21:39:56 +02:00
Artturin
11c3127e38 stdenv: detect the type of variable in {prepend,append}ToVar
stdenv: error if using {prepend,append}ToVar on associative array

i don't know how to prepend to associative array
2022-12-10 04:42:36 +02:00
Artturin
bf972f1873 tests.stdenv: add tests for prependToVar and appendToVar 2022-12-10 04:22:11 +02:00
Artturin
68fb254bf2 tests.stdenv: deduplicate 2022-12-10 04:22:11 +02:00
Artturin
18d00c5814 tests.stdenv: add some env attrset tests 2022-12-08 21:09:02 +02:00