diff options
author | Bas van Dijk <v.dijk.bas@gmail.com> | 2019-06-23 21:11:49 +0200 |
---|---|---|
committer | Bas van Dijk <v.dijk.bas@gmail.com> | 2019-06-23 22:13:57 +0200 |
commit | 76ef802d3d60cc4d199f19ba69e8bcfe63b88e7b (patch) | |
tree | 69818ff85afb45eb3cdae85f8e3849a0c104be07 /pkgs/build-support | |
parent | ba7e7aed08740f5a33e3ef1fa56e4c591af85dc0 (diff) | |
download | nixlib-76ef802d3d60cc4d199f19ba69e8bcfe63b88e7b.tar nixlib-76ef802d3d60cc4d199f19ba69e8bcfe63b88e7b.tar.gz nixlib-76ef802d3d60cc4d199f19ba69e8bcfe63b88e7b.tar.bz2 nixlib-76ef802d3d60cc4d199f19ba69e8bcfe63b88e7b.tar.lz nixlib-76ef802d3d60cc4d199f19ba69e8bcfe63b88e7b.tar.xz nixlib-76ef802d3d60cc4d199f19ba69e8bcfe63b88e7b.tar.zst nixlib-76ef802d3d60cc4d199f19ba69e8bcfe63b88e7b.zip |
mkShell: compose shellHooks
Running the following expression with nix-shell: let pkgs = import <nixpkgs> {}; shell1 = pkgs.mkShell { shellHook = '' echo shell1 ''; }; shell2 = pkgs.mkShell { shellHook = '' echo shell2 ''; }; shell3 = pkgs.mkShell { inputsFrom = [ shell1 shell2 ]; shellHook = '' echo shell3 ''; }; in shell3 Will now results in: shell2 shell1 shell3 Note that packages in the front of inputsFrom have precedence over packages in the back. The outermost mkShell has precedence over all.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/mkshell/default.nix | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pkgs/build-support/mkshell/default.nix b/pkgs/build-support/mkshell/default.nix index a98b4affacba..698974590880 100644 --- a/pkgs/build-support/mkshell/default.nix +++ b/pkgs/build-support/mkshell/default.nix @@ -25,6 +25,7 @@ let "nativeBuildInputs" "propagatedBuildInputs" "propagatedNativeBuildInputs" + "shellHook" ]; in @@ -37,6 +38,9 @@ stdenv.mkDerivation ({ propagatedBuildInputs = mergeInputs "propagatedBuildInputs"; propagatedNativeBuildInputs = mergeInputs "propagatedNativeBuildInputs"; + shellHook = lib.concatStringsSep "\n" (lib.catAttrs "shellHook" + (lib.reverseList inputsFrom ++ [attrs])); + nobuildPhase = '' echo echo "This derivation is not meant to be built, aborting"; |