update Nix file
This commit is contained in:
parent
c911f811c0
commit
ddbd25512a
20
default.nix
20
default.nix
@ -1,20 +0,0 @@
|
||||
with import <nixpkgs> {};
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "myPythonEnv";
|
||||
buildInputs = with pkgs; [
|
||||
python37Full
|
||||
python37Packages.virtualenv
|
||||
];
|
||||
src = null;
|
||||
shellHook = ''
|
||||
if [ ! -d .venv ]; then
|
||||
python -m venv .venv
|
||||
fi
|
||||
source .venv/bin/activate
|
||||
pip install --upgrade pip
|
||||
if [ -s requirements.txt ]; then
|
||||
pip install -r requirements.txt
|
||||
fi
|
||||
'';
|
||||
}
|
37
shell.nix
Normal file
37
shell.nix
Normal file
@ -0,0 +1,37 @@
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
pkgs.mkShell {
|
||||
name = "python-environment";
|
||||
buildInputs = with pkgs; [
|
||||
python3
|
||||
python3Packages.virtualenv
|
||||
];
|
||||
shellHook = ''
|
||||
function log_header {
|
||||
echo -ne "==> \e[32m\e[1m$1\e[0m\n\n"
|
||||
}
|
||||
function log_subheader {
|
||||
echo -ne "--> \e[33m\e[1m$1\e[0m\n\n"
|
||||
}
|
||||
function log {
|
||||
echo -ne " $1\n"
|
||||
}
|
||||
|
||||
echo ""
|
||||
log_header "python_environment"
|
||||
if [ ! -d .venv ]; then
|
||||
python -m venv .venv
|
||||
fi
|
||||
source .venv/bin/activate
|
||||
log_subheader "upgrading pip"
|
||||
pip install --upgrade pip
|
||||
echo ""
|
||||
if [ -s requirements.txt ]; then
|
||||
log_subheader "found requirements.txt, installing packages"
|
||||
pip install -r requirements.txt
|
||||
echo ""
|
||||
fi
|
||||
log_header "package versions"
|
||||
log "$(python --version)"
|
||||
log "$(pip --version)"
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue
Block a user