Merge pull request #63701 from basvandijk/composable-mkshell-shellHook
Improve composability of mkShell
This commit is contained in:
commit
7f7687e79f
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user