Last active
January 25, 2022 15:02
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ 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