2019-11-29 10:20:08 +00:00
|
|
|
# this is an utility for mergeing shells created with mkShell
|
2020-05-15 10:19:07 +00:00
|
|
|
# TODO: make this an attribute of mkShell result set. Or just use inputsFrom.
|
2019-11-29 10:20:08 +00:00
|
|
|
{ lib }:
|
|
|
|
|
2020-05-15 10:19:07 +00:00
|
|
|
super: shells:
|
|
|
|
super.overrideAttrs (super:
|
|
|
|
let
|
|
|
|
inherit (lib) attrByPath unique catAttrs concatStrings;
|
|
|
|
|
|
|
|
mergeAttrsFor = attrName:
|
|
|
|
(attrByPath [attrName] [] super) ++ unique (catAttrs attrName shells);
|
|
|
|
in {
|
|
|
|
inputsFrom = mergeAttrsFor "inputsFrom";
|
|
|
|
buildInputs = mergeAttrsFor "buildInputs";
|
|
|
|
nativeBuildInputs = mergeAttrsFor "nativeBuildInputs";
|
|
|
|
propagatedBuildInputs = mergeAttrsFor "propagatedBuildInputs";
|
|
|
|
propagatedNativeBuildInputs = mergeAttrsFor "propagatedNativeBuildInputs";
|
|
|
|
# shellHook is a string, not a list
|
|
|
|
shellHook = (super.shellHook or "") + concatStrings (catAttrs "shellHook" shells);
|
|
|
|
})
|