forked from pew-org/pew
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
28 lines (28 loc) · 1.1 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
{ nixpkgs ? import <nixpkgs> {} }:
let
pythonPackages = nixpkgs.python3Packages;
python = pythonPackages.python;
in
pythonPackages.buildPythonPackage {
name = "pew";
checkInputs = with nixpkgs; [ which ] ++ (with pythonPackages; [ pytest ]);
propagatedBuildInputs = with pythonPackages; [ virtualenv virtualenv-clone ];
src = ./.;
checkPhase = ''
export NIX=1
export PATH=$out/bin:$PATH
export HOME=$(mktemp -d)
py.test -rws
'';
postFixup = ''
set -euo pipefail
PEW_SITE="$out/lib/${python.libPrefix}/site-packages"
SETUPTOOLS="${pythonPackages.setuptools}/lib/${python.libPrefix}/site-packages"
SETUPTOOLS_SITE=$SETUPTOOLS/$(cat $SETUPTOOLS/setuptools.pth)
CLONEVENV_SITE="${pythonPackages.virtualenv-clone}/lib/${python.libPrefix}/site-packages"
SITE_PACKAGES="[\'$PEW_SITE\',\'$SETUPTOOLS_SITE\',\'$CLONEVENV_SITE\']"
substituteInPlace $PEW_SITE/pew/pew.py \
--replace "from pew.pew" "import sys; sys.path.extend($SITE_PACKAGES); from pew.pew" \
--replace 'sys.executable, "-m", "virtualenv"' "'${pythonPackages.virtualenv}/bin/virtualenv'"
'';
}