2022-12-31 02:31:44 +03:00
|
|
|
{ pkgs ? import <nixpkgs> { }
|
|
|
|
, src ? ./.
|
2020-12-01 12:31:29 +03:00
|
|
|
}:
|
2020-03-16 13:06:32 +03:00
|
|
|
|
|
|
|
|
|
|
|
with pkgs;
|
2023-03-21 05:43:06 +03:00
|
|
|
python311.pkgs.buildPythonApplication rec {
|
2020-03-16 13:06:32 +03:00
|
|
|
name = "nix-update";
|
2020-12-01 12:31:29 +03:00
|
|
|
inherit src;
|
2022-02-16 23:07:54 +03:00
|
|
|
buildInputs = [ makeWrapper ];
|
2023-01-24 21:39:11 +03:00
|
|
|
nativeCheckInputs = [
|
2023-03-21 05:43:06 +03:00
|
|
|
python311.pkgs.pytest
|
|
|
|
python311.pkgs.black
|
2022-11-21 00:09:48 +03:00
|
|
|
ruff
|
2020-12-01 11:30:17 +03:00
|
|
|
glibcLocales
|
|
|
|
mypy
|
2023-03-21 16:06:58 +03:00
|
|
|
# technically not test inputs, but we need it for development in PATH
|
2022-03-10 13:32:58 +03:00
|
|
|
pkgs.nixVersions.stable or nix_2_4
|
2023-03-21 16:06:58 +03:00
|
|
|
nix-prefetch-git
|
2020-11-18 11:23:07 +03:00
|
|
|
];
|
2020-03-16 13:06:32 +03:00
|
|
|
checkPhase = ''
|
|
|
|
echo -e "\x1b[32m## run black\x1b[0m"
|
2022-11-15 02:38:43 +03:00
|
|
|
LC_ALL=en_US.utf-8 black --check . bin/nix-update
|
2022-11-21 00:09:48 +03:00
|
|
|
echo -e "\x1b[32m## run ruff\x1b[0m"
|
2023-01-07 23:28:20 +03:00
|
|
|
ruff . bin/nix-update
|
2020-03-16 13:06:32 +03:00
|
|
|
echo -e "\x1b[32m## run mypy\x1b[0m"
|
2021-12-13 16:40:59 +03:00
|
|
|
mypy --no-warn-unused-ignores --strict nix_update tests
|
2020-03-16 13:06:32 +03:00
|
|
|
'';
|
|
|
|
makeWrapperArgs = [
|
2022-12-31 02:31:44 +03:00
|
|
|
"--prefix PATH"
|
|
|
|
":"
|
2023-03-21 05:43:06 +03:00
|
|
|
(lib.makeBinPath [ pkgs.nixVersions.stable or nix_2_4 nixpkgs-fmt nixpkgs-review nix-prefetch-git ])
|
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; };
|
|
|
|
}
|