mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-23 06:03:40 +00:00
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>
59 lines
2.5 KiB
Nix
59 lines
2.5 KiB
Nix
{ pkgs, callPackage }:
|
|
|
|
with pkgs;
|
|
|
|
{
|
|
cc-wrapper = callPackage ./cc-wrapper { };
|
|
cc-wrapper-gcc = callPackage ./cc-wrapper { stdenv = gccStdenv; };
|
|
cc-wrapper-gcc7 = callPackage ./cc-wrapper { stdenv = gcc7Stdenv; };
|
|
cc-wrapper-gcc8 = callPackage ./cc-wrapper { stdenv = gcc8Stdenv; };
|
|
cc-wrapper-gcc9 = callPackage ./cc-wrapper { stdenv = gcc9Stdenv; };
|
|
cc-wrapper-clang = callPackage ./cc-wrapper { stdenv = llvmPackages.stdenv; };
|
|
cc-wrapper-libcxx = callPackage ./cc-wrapper { stdenv = llvmPackages.libcxxStdenv; };
|
|
cc-wrapper-clang-5 = callPackage ./cc-wrapper { stdenv = llvmPackages_5.stdenv; };
|
|
cc-wrapper-libcxx-5 = callPackage ./cc-wrapper { stdenv = llvmPackages_5.libcxxStdenv; };
|
|
cc-wrapper-clang-6 = callPackage ./cc-wrapper { stdenv = llvmPackages_6.stdenv; };
|
|
cc-wrapper-libcxx-6 = callPackage ./cc-wrapper { stdenv = llvmPackages_6.libcxxStdenv; };
|
|
cc-wrapper-clang-7 = callPackage ./cc-wrapper { stdenv = llvmPackages_7.stdenv; };
|
|
cc-wrapper-libcxx-7 = callPackage ./cc-wrapper { stdenv = llvmPackages_7.libcxxStdenv; };
|
|
cc-wrapper-clang-8 = callPackage ./cc-wrapper { stdenv = llvmPackages_8.stdenv; };
|
|
cc-wrapper-libcxx-8 = callPackage ./cc-wrapper { stdenv = llvmPackages_8.libcxxStdenv; };
|
|
cc-wrapper-clang-9 = callPackage ./cc-wrapper { stdenv = llvmPackages_9.stdenv; };
|
|
cc-wrapper-libcxx-9 = callPackage ./cc-wrapper { stdenv = llvmPackages_9.libcxxStdenv; };
|
|
stdenv-inputs = callPackage ./stdenv-inputs { };
|
|
|
|
haskell = callPackage ./haskell { };
|
|
|
|
cc-multilib-gcc = callPackage ./cc-wrapper/multilib.nix { stdenv = gccMultiStdenv; };
|
|
cc-multilib-clang = callPackage ./cc-wrapper/multilib.nix { stdenv = clangMultiStdenv; };
|
|
|
|
install-shell-files = callPackage ./install-shell-files {};
|
|
|
|
kernel-config = callPackage ./kernel.nix {};
|
|
|
|
ld-library-path = callPackage ./ld-library-path {};
|
|
|
|
macOSSierraShared = callPackage ./macos-sierra-shared {};
|
|
|
|
cross = callPackage ./cross {};
|
|
|
|
rustCustomSysroot = callPackage ./rust-sysroot {};
|
|
buildRustCrate = callPackage ../build-support/rust/build-rust-crate/test { };
|
|
importCargoLock = callPackage ../build-support/rust/test/import-cargo-lock { };
|
|
|
|
vim = callPackage ./vim {};
|
|
|
|
nixos-functions = callPackage ./nixos-functions {};
|
|
|
|
patch-shebangs = callPackage ./patch-shebangs {};
|
|
|
|
texlive = callPackage ./texlive {};
|
|
|
|
cuda = callPackage ./cuda { };
|
|
|
|
trivial = callPackage ../build-support/trivial-builders/test.nix {};
|
|
trivial-overriding = callPackage ../build-support/trivial-builders/test-overriding.nix {};
|
|
|
|
writers = callPackage ../build-support/writers/test.nix {};
|
|
}
|