Merge pull request #63701 from basvandijk/composable-mkshell-shellHook

Improve composability of mkShell
This commit is contained in:
zimbatm 2019-06-23 22:39:54 +00:00 committed by GitHub
commit 7f7687e79f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,13 +11,8 @@
...
}@attrs:
let
mergeInputs = name:
let
op = item: sum: sum ++ item."${name}" or [];
nul = [];
list = [attrs] ++ inputsFrom;
in
lib.foldr op nul list;
mergeInputs = name: lib.concatLists (lib.catAttrs name
([attrs] ++ inputsFrom));
rest = builtins.removeAttrs attrs [
"inputsFrom"
@ -25,6 +20,7 @@ let
"nativeBuildInputs"
"propagatedBuildInputs"
"propagatedNativeBuildInputs"
"shellHook"
];
in
@ -37,6 +33,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";