aboutsummaryrefslogtreecommitdiff
path: root/lib/mk-dev-shell.nix
blob: fe2ac027bc7f957a55b372658191b32971f53611 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
flake:
{ pkgs
, tools ? []
, envVars ? {}
, shell ? null
}:

let
  shellLib = flake.lib.shell { inherit pkgs; };

in pkgs.mkShell {
  packages = tools;
  shellHook = ''
    ${shellLib.exportEnvVars envVars}

    ${shellLib.ifSomeAttrs envVars shellLib.printEnvVars}
    ${shellLib.ifSomeList tools shellLib.printBins}
    echo

    ${if (shell != null) then shell else shellLib.startUserShell}
    exit $?
  '';
}