aboutsummaryrefslogtreecommitdiff
path: root/lib/mk-dev-shell.nix
blob: 4f46d69b1e1f4ba09ba07bdef7ba5873f3d7954f (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}

    ${pkgs.lib.optionalString (envVars != {}) (shellLib.printEnvVars envVars)}
    ${pkgs.lib.optionalString (tools != []) (shellLib.printBins tools)}
    echo

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