devshell: remove dependency on clan-cli derivation
All checks were successful
checks / check-links (pull_request) Successful in 21s
checks / checks-impure (pull_request) Successful in 1m50s
checks / checks (pull_request) Successful in 3m42s

The devShell depended on clan-cli due to it being included as a dependency in the treefmt config. This is not optimal because this makes the devshell rebuild unnecessary often and also lead to build failures of the dev-shell if the clan-cli code is in a broken state (git rebasing, or during development etc.)
This commit is contained in:
DavHau 2024-03-19 13:00:59 +07:00
parent b2b94b269a
commit 580010581c
4 changed files with 18 additions and 9 deletions

View File

@ -15,11 +15,9 @@
ps:
clan-cli.propagatedBuildInputs
++ clan-cli.devDependencies
++ [
ps.pip
# clan-vm-manager deps
ps.pygobject3
]
++ [ ps.pip ]
++ [ clan-vm-manager.externalPythonDeps ]
# clan-vm-manager deps
);
linuxOnlyPackages = lib.optionals pkgs.stdenv.isLinux [ pkgs.xdg-utils ];
in

View File

@ -10,7 +10,8 @@
treefmt.programs.mypy.enable = true;
treefmt.programs.mypy.directories = {
"pkgs/clan-cli".extraPythonPackages = self'.packages.clan-cli.pytestDependencies;
"pkgs/clan-vm-manager".extraPythonPackages = self'.packages.clan-vm-manager.propagatedBuildInputs;
"pkgs/clan-vm-manager".extraPythonPackages =
self'.packages.clan-vm-manager.externalPythonDeps ++ self'.packages.clan-cli.pytestDependencies;
};
treefmt.settings.formatter.nix = {

View File

@ -24,7 +24,7 @@ let
mimeTypes = [ "x-scheme-handler/clan" ];
};
in
python3.pkgs.buildPythonApplication {
python3.pkgs.buildPythonApplication rec {
name = "clan-vm-manager";
src = source;
format = "pyproject";
@ -51,13 +51,19 @@ python3.pkgs.buildPythonApplication {
# We need to propagate the build inputs to nix fmt / treefmt
propagatedBuildInputs = [
(python3.pkgs.toPythonModule clan-cli)
pygobject3
pygobject-stubs
passthru.externalPythonDeps
];
# also re-expose dependencies so we test them in CI
passthru = {
inherit desktop-file;
# Keep external dependencies in a separate lists to refer to thm elsewhere
# This helps avoiding issues like dev-shells accidentally depending on
# nix derivations of local packages.
externalPythonDeps = [
pygobject3
pygobject-stubs
];
tests = {
clan-vm-manager-no-breakpoints = runCommand "clan-vm-manager-no-breakpoints" { } ''
if grep --include \*.py -Rq "breakpoint()" ${source}; then

View File

@ -22,6 +22,10 @@ disallow_untyped_calls = true
disallow_untyped_defs = true
no_implicit_optional = true
[[tool.mypy.overrides]]
module = "clan_cli.*"
ignore_missing_imports = true
[tool.ruff]
target-version = "py311"
line-length = 88