2020-12-13 18:47:22 +00:00
|
|
|
# pkgs.mkShell {#sec-pkgs-mkShell}
|
|
|
|
|
2021-05-13 18:17:29 +01:00
|
|
|
`pkgs.mkShell` is a special kind of derivation that is only useful when using
|
|
|
|
it combined with `nix-shell`. It will in fact fail to instantiate when invoked
|
|
|
|
with `nix-build`.
|
2020-12-13 18:47:22 +00:00
|
|
|
|
|
|
|
## Usage {#sec-pkgs-mkShell-usage}
|
|
|
|
|
|
|
|
```nix
|
|
|
|
{ pkgs ? import <nixpkgs> {} }:
|
|
|
|
pkgs.mkShell {
|
2021-05-13 18:17:29 +01:00
|
|
|
# specify which packages to add to the shell environment
|
|
|
|
packages = [ pkgs.gnumake ];
|
|
|
|
# add all the dependencies, of the given packages, to the shell environment
|
2020-12-13 18:47:22 +00:00
|
|
|
inputsFrom = with pkgs; [ hello gnutar ];
|
|
|
|
}
|
|
|
|
```
|