Files
nixpkgs/doc/getting-started/dev-environments.md
2026-08-05 11:22:59 +02:00

921 B

Dev environments

Create a shell.nix with the following:

# shell.nix
let
  nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz";
  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://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz' 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