Files
nixpkgs/doc/getting-started/dev-environments.md
2026-09-27 10:21:11 +02:00

913 B

Dev environments

Create a shell.nix with the following:

# shell.nix
let
  nixpkgs = fetchTarball "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst";
  pkgs = import nixpkgs { };
in
pkgs.mkShell {
  packages = [ pkgs.python3 ];
  shellHook = ''
    echo "Welcome in my nix shell"
  '';
}

run

nix-shell

This activates your shell.nix and you should see:

unpacking 'https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst' into the Git cache...
Welcome in your nix shell

python3 is available

$ python3 --version

To leave the shell

ctrl+D

:::{.note} You should use pinned nixpkgs. The example used unstable here for demonstration purposes only :::

For further information check out nix-shell