44 lines
1 KiB
Nix
44 lines
1 KiB
Nix
|
# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
|
||
|
#
|
||
|
# SPDX-License-Identifier: Apache-2.0
|
||
|
|
||
|
{ depot, pkgs, ... }:
|
||
|
|
||
|
let
|
||
|
python = pkgs.python3.withPackages (ps: with ps; [
|
||
|
requests
|
||
|
beautifulsoup4
|
||
|
prometheus_client
|
||
|
]);
|
||
|
|
||
|
filterSourcePred = (path: type: type != "directory" || (
|
||
|
baseNameOf path != "__pycache__" &&
|
||
|
baseNameOf path != "node_modules" &&
|
||
|
true));
|
||
|
in
|
||
|
pkgs.stdenvNoCC.mkDerivation rec {
|
||
|
name = "valveindexinstock";
|
||
|
|
||
|
src = builtins.filterSource filterSourcePred ./.;
|
||
|
|
||
|
buildInputs = with pkgs; [ makeWrapper ];
|
||
|
propagatedBuildInputs = [ python ];
|
||
|
|
||
|
installPhase = ''
|
||
|
sitepkgdir="$out/lib/${python.libPrefix}/site-packages"
|
||
|
pkgdir="$sitepkgdir/valveindexinstock"
|
||
|
mkdir -p $pkgdir
|
||
|
cp -R \
|
||
|
*.py \
|
||
|
$pkgdir
|
||
|
|
||
|
mkdir "$out/bin"
|
||
|
makeWrapper "${python}/bin/python" "$out/bin/valveindexinstock" \
|
||
|
--add-flags "-m" \
|
||
|
--add-flags "valveindexinstock" \
|
||
|
--suffix PYTHONPATH : "$sitepkgdir"
|
||
|
'';
|
||
|
|
||
|
passthru.pythonEnv = python;
|
||
|
}
|