forked from DataDog/system-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.nix
51 lines (41 loc) · 1.45 KB
/
shell.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
{
# use the environment channel
pkgs ? import <nixpkgs> {},
# use a pinned package state
pinned ? import(fetchTarball("https://github.com/NixOS/nixpkgs/archive/14d9b465c71.tar.gz")) {},
}:
let
# get these python packages from nix
python_packages = python-packages: [
python-packages.pip
];
# use this pyton version, and include the abvoe packages
python = pinned.python39.withPackages python_packages;
# control llvm/clang version (e.g for packages built form source)
llvm = pinned.llvmPackages_12;
in llvm.stdenv.mkDerivation {
# unique project name for this environment derivation
name = "system-tests.devshell";
buildInputs = [
# version to use + default packages are declared above
python
# linters
pinned.shellcheck
# for scripts
pinned.bash
pinned.fswatch
pinned.rsync
# for c++ dependencies such as grpcio-tools
llvm.libcxx.dev
];
shellHook = ''
export PYTHON_VERSION="$(python -c 'import platform; import re; print(re.sub(r"\.\d+$", "", platform.python_version()))')"
# replicate virtualenv behaviour
export PIP_PREFIX="$PWD/vendor/python/$PYTHON_VERSION/packages"
export PYTHONPATH="$PIP_PREFIX/lib/python$PYTHON_VERSION/site-packages:$PYTHONPATH"
unset SOURCE_DATE_EPOCH
export PATH="$PIP_PREFIX/bin:$PATH"
# for grpcio-tools, which is building from source but doesn't pick up the proper include
export CFLAGS="-I${llvm.libcxx.dev}/include/c++/v1"
'';
}