mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-30 08:00:59 +00:00
913 B
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