1# pkgs.mkShell {#sec-pkgs-mkShell} 2 3`pkgs.mkShell` is a specialized `stdenv.mkDerivation` that removes some 4repetition when using it with `nix-shell` (or `nix develop`). 5 6## Usage {#sec-pkgs-mkShell-usage} 7 8Here is a common usage example: 9 10```nix 11{ 12 pkgs ? import <nixpkgs> { }, 13}: 14pkgs.mkShell { 15 packages = [ pkgs.gnumake ]; 16 17 inputsFrom = [ 18 pkgs.hello 19 pkgs.gnutar 20 ]; 21 22 shellHook = '' 23 export DEBUG=1 24 ''; 25} 26``` 27 28## Attributes {#sec-pkgs-mkShell-attributes} 29 30* `name` (default: `nix-shell`). Set the name of the derivation. 31* `packages` (default: `[]`). Add executable packages to the `nix-shell` environment. 32* `inputsFrom` (default: `[]`). Add build dependencies of the listed derivations to the `nix-shell` environment. 33* `shellHook` (default: `""`). Bash statements that are executed by `nix-shell`. 34 35... all the attributes of `stdenv.mkDerivation`. 36 37## Variants {#sec-pkgs-mkShell-variants} 38 39`pkgs.mkShellNoCC` is a variant that uses `stdenvNoCC` instead of `stdenv` as base environment. This is useful if no C compiler is needed in the shell environment. 40 41## Building the shell {#sec-pkgs-mkShell-building} 42 43This derivation output will contain a text file that contains a reference to 44all the build inputs. This is useful in CI where we want to make sure that 45every derivation, and its dependencies, build properly. Or when creating a GC 46root so that the build dependencies don't get garbage-collected.