Skip to content

Commit 2fbc026

Browse files
committed
Merge branch 'avieth/shell-inputs' of https://github.com/avieth/haskell.nix
2 parents 236ad8d + 7f3bf67 commit 2fbc026

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

builder/shell-for.nix

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,18 @@ let
9292
# We need to remove any inputs which are selected components (see above).
9393
# `buildInputs`, `propagatedBuildInputs`, and `executableToolDepends` contain component
9494
# derivations, not packages, so we use `removeSelectedInputs`).
95-
systemInputs = removeSelectedInputs (lib.concatMap
96-
(c: c.buildInputs ++ c.propagatedBuildInputs) selectedComponents);
95+
#
96+
# Also, we take care to keep duplicates out of the list, otherwise we may see
97+
# "Argument list too long" errors from bash when entering a shell.
98+
#
99+
# Version of `lib.unique` that should be fast if the name attributes are unique
100+
uniqueWithName = list:
101+
lib.concatMap lib.unique (
102+
builtins.attrValues (
103+
builtins.groupBy (x: if __typeOf x == "set" then x.name or "noname" else "notset") list));
104+
allSystemInputs = lib.concatMap (c: c.buildInputs ++ c.propagatedBuildInputs) selectedComponents;
105+
systemInputs = removeSelectedInputs (uniqueWithName allSystemInputs);
106+
97107
nativeBuildInputs = removeSelectedInputs
98108
(lib.concatMap (c: c.executableToolDepends) selectedComponents);
99109

0 commit comments

Comments
 (0)