nix-update/default.nix

37 lines
934 B
Nix
Raw Normal View History

2020-03-16 13:06:32 +03:00
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
python3.pkgs.buildPythonApplication rec {
name = "nix-update";
src = ./.;
buildInputs = [ makeWrapper ];
checkInputs = [
2020-12-01 11:30:17 +03:00
python3.pkgs.pytest
python3.pkgs.black
python3.pkgs.flake8
glibcLocales
mypy
# technically not a test input, but we need it for development in PATH
nixFlakes
];
2020-03-16 13:06:32 +03:00
checkPhase = ''
echo -e "\x1b[32m## run black\x1b[0m"
LC_ALL=en_US.utf-8 black --check .
2020-12-01 11:37:57 +03:00
echo -e "\x1b[32m## run pytest\x1b[0m"
py.test -s .
2020-03-16 13:06:32 +03:00
echo -e "\x1b[32m## run flake8\x1b[0m"
flake8 nix_update
echo -e "\x1b[32m## run mypy\x1b[0m"
2020-05-03 09:53:16 +03:00
mypy --strict nix_update
2020-03-16 13:06:32 +03:00
'';
makeWrapperArgs = [
"--prefix PATH" ":" (lib.makeBinPath [ nixFlakes nix-prefetch ])
2020-03-16 13:06:32 +03:00
];
shellHook = ''
# workaround because `python setup.py develop` breaks for me
'';
passthru.env = buildEnv { inherit name; paths = buildInputs ++ checkInputs; };
}