-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev-deploy.nix
41 lines (36 loc) · 1.3 KB
/
dev-deploy.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{ pkgs ? import <nixpkgs> {} }:
let
nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {
inherit pkgs;
};
myPython = (with pkgs; nur.repos.neumantm.pythonWithPipenv.override { myPythonDerivation = python37; myPythonPackages = pp: with pp; [ pylint ]; });
in
pkgs.mkShell {
buildInputs = with pkgs; [myPython];
shellHook = ''
function initPipenvIfNeeded {
if ! pipenv --venv > /dev/null 2>&1 ;then
pipenv install --dev
fi
}
function loadPipenv {
export loadPipenvDepth=$(expr $loadPipenvDepth + 1)
initPipenvIfNeeded
source "$(pipenv --venv)/bin/activate"
if ! python -c "" ;then
if [ $loadPipenvDepth -gt 3 ] ;then
echo "Could not load pipenv after 3 tries."
exit 1
fi
pipenv --rm
loadPipenv
fi
}
loadPipenv || exit
unset loadPipenvDepth
export FLASK_APP=ums_api
export FLASK_DEBUG=1 # to enable autoreload
export MODE=debug
flask create_db
'';
}