Skip to content

Instantly share code, notes, and snippets.

@tabdulradi
Last active January 25, 2022 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tabdulradi/7e76374cb933dbe641a8e691047fd23c to your computer and use it in GitHub Desktop.
Save tabdulradi/7e76374cb933dbe641a8e691047fd23c to your computer and use it in GitHub Desktop.
Nix Shell for local development on Python projects. Ideal for mixed teams that doesn't have full Nix buy-in
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
python3
];
shellHook = ''
if [ -d ".venv" ]
then
echo "Using existing virtual env"
else
echo "Setting up virtual env"
python3 -m venv .venv
pip3 install --user -r ./requirements-test.txt
fi && source .venv/bin/activate
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment