summaryrefslogtreecommitdiff
path: root/pkgs/test/stdenv (follow)
Commit message (Expand)AuthorAgeFilesLines
* pkgs/test/stdenv/default.nix: fix eval on darwinTristan Ross2024-06-301-0/+3
* stdenv: make inputDerivation never fixed-output•••This fixes using inputDerivation on derivations that are fixed-output. Previously: ``` nix-repl> drv = runCommand "huh" { outputHash = "sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU="; outputHashAlgo = "sha256"; outputHashType = "flat"; } "touch $out" nix-repl> drv.inputDerivation «derivation /nix/store/d8mjs6cmmvsr1fv7psm6imis5pmh9bcs-huh.drv» nix-repl> :b drv.inputDerivation error: fixed output derivation 'huh' is not allowed to refer to other store paths. You may need to use the 'unsafeDiscardReferences' derivation attribute, see the manual for more details. ``` Fixes: https://github.com/NixOS/nixpkgs/issues/304209 Jade Lovelace2024-04-151-0/+22
* Merge pull request #255463 from emilylange/stdenv/patch-shebangs-trailing-new...•••patch-shebangs: fix crash with shebang without trailing newlineRick van Schijndel2024-02-161-1/+16
|\
| * patch-shebangs: fix crash with shebang without trailing newline•••This fixes a bug where `patchShebangs` crashes when trying to patch files that contain only a shebang (e.g. `#!/bin/bash`) (and nothing else) and do not end with a newline. Such file can be produced using `printf "#!/bin/bash" > example` or `echo -n "#!/bin/bash" > example`. I don't understand why one would want to create such files, as they do literally nothing, but the chromium tarball we are using started shipping some 🫠 Full reproducer: ```nix with import <nixpkgs> { }; stdenv.mkDerivation { dontUnpack = true; name = "patch-shebangs-no-trailing-newline-reproducer"; postPatch = '' printf "#!/bin/bash" > reproducer chmod +x reproducer patchShebangs reproducer ''; } ``` ``` ❯ nix-build reproducer.nix this derivation will be built: /nix/store/vmbshdkdk4a0bayw3wi21wvxyhzpcsy2-patch-shebangs-no-trailing-newline-reproducer.drv building '/nix/store/vmbshdkdk4a0bayw3wi21wvxyhzpcsy2-patch-shebangs-no-trailing-newline-reproducer.drv'... patching sources patching script interpreter paths in reproducer /nix/store/vr6wwdxkmyy44sg0gwxi10b8fc5zhwz0-stdenv-linux/setup: line 144: pop_var_context: head of shell_variables not a function context error: builder for '/nix/store/vmbshdkdk4a0bayw3wi21wvxyhzpcsy2-patch-shebangs-no-trailing-newline-reproducer.drv' failed with exit code 1; last 3 log lines: > patching sources > patching script interpreter paths in reproducer > /nix/store/vr6wwdxkmyy44sg0gwxi10b8fc5zhwz0-stdenv-linux/setup: line 144: pop_var_context: head of shell_variables not a function context For full logs, run 'nix log /nix/store/vmbshdkdk4a0bayw3wi21wvxyhzpcsy2-patch-shebangs-no-trailing-newline-reproducer.drv'. ``` emilylange2023-09-161-1/+16
* | tests/stdenv: Check derivations with an MD5 `outputHash` fail to evaluatenicoo2023-10-251-0/+9
|/
* patch-shebangs: add a flag to update shebangs with store paths•••This change adds a flag to update shebang paths that point to the Nix store. This is particularly useful when a cross-compiled package uses same script at compile-time and run-time, but the interpreter must be changed since hostPlatform != buildPlatform. Ivan Trubach2023-06-191-1/+18
* tests.stdenv.hooks.reproducible-builds: fix mistakeArtturin2023-06-171-1/+1
* tests.stdenv.test-inputDerivation: initAlyssa Ross2023-05-091-0/+15
* pkgs/test/stdenv/default.nix: add gcc-stageCompare•••This commit adds a derivation `gcc-stageCompare` to `pkgs/test/stdenv/default.nix`. It is important to always build this derivation whenever building `stdenv`! Because we are using a Nix-driven bootstrap instead of gcc's built-in `--enable-bootstrap`, the `gcc` derivation no longer performs the post-self-compilation sanity check. You must build this derivation in order to perform that sanity check. The major benefit of this new approach is that the sanity check (which involves a third compilation of gcc) can be performed *concurrently* with all packages that depend on `stdenv`, rather than serially. Since `stdenv` has very little derivation-level parallelism it cannot take advantage of more than one or perhaps two builders. If you have three or more builders this commit will reduce the time-to-rebuild-stdenv by around 20% (one of three gcc rebuilds is removed from the critical path, and stdenv's build time is dominated by roughly 3*gcc + 1*binutils + 1*bison-test-suite). Co-authored-by: Sandro <sandro.jaeckel@gmail.com> Adam Joseph2023-04-021-0/+32
* tests.stdenv.outputs-no-out: update expectedMsgArtturin2023-03-021-1/+1
* tests.stdenv.outputs-no-out: cause less rebuilds•••now gcc isn't built Artturin2023-03-021-2/+4
* Merge staging-next into staginggithub-actions[bot]2023-02-232-2/+2
|\
| * 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 Artturin2023-02-221-1/+1
| * tests.stdenv.outputs-no-out: fixArtturin2023-02-221-1/+1
* | tests.stdenv: add hooks.patch-shebangs.split-string & tweak testsArtturin2023-02-171-37/+65
* | tests.stdenv: move patch-shebangs testArtturin2023-02-173-4/+74
|/
* Merge pull request #212286 from Artturin/runonall•••make-symlinks-relative: run on all outputsArtturi2023-01-251-1/+11
|\
| * make-symlinks-relative: run on all outputsArtturin2023-01-231-1/+11
* | 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). Robert Hensing2023-01-161-1/+21
|/
* Merge pull request #205944 from ncfavier/structured-attrs-envNaïm Favier2022-12-151-0/+20
|\
| * tests.stdenv: check that attrs in env are exportedArtturin2022-12-151-0/+1
| * 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. Naïm Favier2022-12-151-0/+19
* | stdenv: sort defaultNativeBuildInputs alphabeticallyArtturin2022-12-131-70/+66
* | tests.stdenv.hooks: add more testsArtturin2022-12-122-3/+98
* | tests: move stdenv hook tests to stdenv.hooksArtturin2022-12-122-0/+41
* | 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 Artturin2022-12-121-0/+71
|/
* 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 Artturin2022-12-101-4/+15
* tests.stdenv: add tests for prependToVar and appendToVarArtturin2022-12-101-7/+87
* tests.stdenv: deduplicateArtturin2022-12-101-73/+34
* tests.stdenv: add some env attrset testsArtturin2022-12-081-0/+107