Skip to content

Commit 6edee82

Browse files
committed
improve the missing package error
1 parent 2f8852f commit 6edee82

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

mkDevShell/options.nix

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ let
44
resolveKey = key:
55
let
66
attrs = builtins.filter builtins.isString (builtins.split "\\." key);
7+
op = sum: attr: sum.${attr} or (throw "package \"${key}\" not found");
78
in
8-
builtins.foldl' (sum: attr: sum.${attr}) pkgs attrs
9+
builtins.foldl' op pkgs attrs
910
;
1011

1112
pad = str: num:
@@ -48,7 +49,7 @@ let
4849

4950
opCat = { name, value }:
5051
let
51-
opCmd = { name, help, ...}:
52+
opCmd = { name, help, ... }:
5253
let
5354
len = maxCommandLength - (builtins.stringLength name);
5455
in
@@ -57,7 +58,7 @@ let
5758
else
5859
"${pad name len} - ${help}";
5960
in
60-
"\n[${name}]\n" + builtins.concatStringsSep "\n" (map opCmd value);
61+
"\n[${name}]\n" + builtins.concatStringsSep "\n" (map opCmd value);
6162
in
6263
builtins.concatStringsSep "\n" (map opCat commandByCategoriesSorted)
6364
;

0 commit comments

Comments
 (0)