Python: Difference between revisions
Follow best practices by pinning the nixpkgs commit in shell.nix |
|||
| Line 11: | Line 11: | ||
# shell.nix | # shell.nix | ||
let | let | ||
pkgs = import | # We pin to a specific nixpkgs commit for reproducibility. | ||
# Last updated: 2024-04-29. Check for new commits at https://status.nixos.org. | |||
pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/cf8cc1201be8bc71b7cbbbdaf349b22f4f99c7ae.tar.gz") {}; | |||
in pkgs.mkShell { | in pkgs.mkShell { | ||
packages = [ | packages = [ | ||
| Line 28: | Line 30: | ||
Once you have picked the Python packages you want, run <code>nix-shell</code> (or <code>nix develop -f shell.nix</code>) to build the Python environment and enter it. Once in the environment Python will be available in your PATH, so you can run eg. <code>python --version</code>. | Once you have picked the Python packages you want, run <code>nix-shell</code> (or <code>nix develop -f shell.nix</code>) to build the Python environment and enter it. Once in the environment Python will be available in your PATH, so you can run eg. <code>python --version</code>. | ||
==== Using a Python packages not in Nixpkgs ==== | ==== Using a Python packages not in Nixpkgs ==== | ||