-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdefault.nix
58 lines (49 loc) · 1.72 KB
/
default.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{ pyVersion ? "311"
, isDevEnv ? true
}:
let
commonEnv = import ./nixpkgs {};
pkgs = commonEnv.pkgs;
python = pkgs."python${pyVersion}";
pythonPkgs = pkgs."python${pyVersion}Packages";
devLibs = if isDevEnv then [ pythonPkgs.twine pythonPkgs.wheel ] else [ pythonPkgs.coveralls ];
# Make a new "derivation" that represents our shell
devEnv = pkgs.mkShellNoCC {
name = "typeit";
# The packages in the `buildInputs` list will be added to the PATH in our shell
# Python-specific guide:
# https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/python.section.md
nativeBuildInputs = with pkgs; [
# see https://nixos.org/nixos/packages.html
# Python distribution
python
pythonPkgs.virtualenv
ncurses
libxml2
libxslt
libzip
zlib
which
] ++ devLibs;
shellHook = ''
# set SOURCE_DATE_EPOCH so that we can use python wheels
export SOURCE_DATE_EPOCH=$(date +%s)
export VENV_DIR="$PWD/.venv${pyVersion}"
export PATH=$VENV_DIR/bin:$PATH
export PYTHONPATH=""
export LANG=en_US.UTF-8
# https://python-poetry.org/docs/configuration/
export PIP_CACHE_DIR="$PWD/.local/pip-cache${pyVersion}"
# Setup virtualenv
if [ ! -d $VENV_DIR ]; then
virtualenv $VENV_DIR
pip install -r requirements/minimal.txt
pip install -r requirements/test.txt
pip install -r requirements/extras/third_party.txt
fi
'';
};
in
{
inherit devEnv;
}