a71e906e3a
This fixes #126344, specifically with the goal of enabling overriding the checkPhase argument. See `design notes` at the end for details. This allows among other things, enabling bash extension for the `checkPhase`. Previously using such bash extensions was prohibited by the `writeShellScript` code because there was no way to enable the extension in the checker. As an example: ```nix (writeShellScript "foo" '' shopt -s extglob echo @(foo|bar) '').overrideAttrs (old: { checkPhase = '' # use subshell to preserve outer environment ( export BASHOPTS shopt -s extglob ${old.checkPhase} ) ''; }) ``` This commit also adds tests for this feature to `pkgs/tests/default.nix`, under `trivial-overriding`. The test code is located at `pkgs/build-support/trivial-builders/test-overriding.nix`. Design notes: ------------- Per discussion with @sternenseemann, the original approach of just wrapping `writeTextFile` in `makeOverridable` had the issue that combined with `callPackage` in the following form, would shadow the `.override` attribute of the `writeTextFile`: ```nix with import <nixpkgs>; callPackage ({writeShellScript}: writeShellScript "foo" "echo foo") ``` A better approach can be seen in this commit, where `checkPhase` is moved from an argument of `writeTextFile`, which is substituted into `buildCommand`, into an `mkDerivation` argument, which is substituted from the environment and `eval`-ed. (see the source) This way we can simple use `.overideAttrs` as usual, and this also makes `checkPhase` a bit more conformant to `mkDerivation` naming, with respect to phases generally being overridable attrs. Co-authored-by: sterni <sternenseemann@systemli.org> Co-authored-by: Naïm Favier <n@monade.li> |
||
---|---|---|
.. | ||
add-opengl-runpath | ||
agda | ||
alternatives | ||
appimage | ||
bintools-wrapper | ||
build-bazel-package | ||
build-dotnet-package | ||
build-fhs-userenv | ||
build-fhs-userenv-bubblewrap | ||
build-setupcfg | ||
buildenv | ||
cc-wrapper | ||
coq | ||
docker | ||
dotnetbuildhelpers | ||
dotnetenv | ||
emacs | ||
expand-response-params | ||
fetchbitbucket | ||
fetchbower | ||
fetchbzr | ||
fetchcvs | ||
fetchdarcs | ||
fetchdocker | ||
fetchfirefoxaddon | ||
fetchfossil | ||
fetchgit | ||
fetchgitea | ||
fetchgithub | ||
fetchgitiles | ||
fetchgitlab | ||
fetchgitlocal | ||
fetchgx | ||
fetchhg | ||
fetchipfs | ||
fetchmavenartifact | ||
fetchmtn | ||
fetchnuget | ||
fetchpatch | ||
fetchrepoorcz | ||
fetchrepoproject | ||
fetchs3 | ||
fetchsavannah | ||
fetchsourcehut | ||
fetchsvn | ||
fetchsvnrevision | ||
fetchsvnssh | ||
fetchurl | ||
fetchzip | ||
go | ||
icon-conv-tools | ||
install-shell-files | ||
kernel | ||
libredirect | ||
make-desktopitem | ||
make-startupitem | ||
make-symlinks | ||
mkshell | ||
mono-dll-fixer | ||
nix-gitignore | ||
nuke-references | ||
ocaml | ||
oci-tools | ||
pkg-config-wrapper | ||
prefer-remote-fetch | ||
references-by-popularity | ||
release | ||
remove-references-to | ||
replace-secret | ||
rust | ||
setup-hooks | ||
singularity-tools | ||
skaware | ||
snap | ||
src-only | ||
substitute | ||
substitute-files | ||
templaterpm | ||
trivial-builders | ||
upstream-updater | ||
vm | ||
wrapper-common | ||
writers | ||
build-maven.nix | ||
build-pecl.nix | ||
closure-info.nix | ||
dhall-to-nix.nix | ||
plugins.nix | ||
replace-dependency.nix | ||
setup-systemd-units.nix | ||
source-from-head-fun.nix | ||
trivial-builders.nix |