blob: e0bb4418fd887403e35c0c6d2bdcb603515bb3a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
{ pkgs
, tools ? []
, envVars ? {}
}:
let
# TODO: escape values properly
exportEnvVar = k: v: ''export ${k}="${v}"; echo ${k}=\"${v}\"'';
exportedEnvVars = pkgs.lib.mapAttrsToList exportEnvVar envVars;
in pkgs.mkShell {
buildInputs = tools;
# TODO: handle case with no env variable set
# TODO: handle case with no package in tools
# TODO: allow custom shell
shellHook = ''
echo -e "\nDEVSHELL ENVIRONMENT VARIABLES:"
${pkgs.lib.concatStringsSep "\n" exportedEnvVars}
echo -e "\nDEVSHELL COMMANDS:"
ls "${pkgs.symlinkJoin { name = "env"; paths = tools; }}/bin"
# Use the default user shell instead of Bash
$(${pkgs.finger_bsd}/bin/finger $USER \
| ${pkgs.gnugrep}/bin/grep -oP 'Shell: \K.*')
exit $?
'';
}
|