select-shell: Fix breakage with previous shell.nix change
checks / check-links (pull_request) Successful in 13s Details
checks / checks-impure (pull_request) Successful in 1m51s Details
checks / checks (pull_request) Successful in 4m11s Details

This commit is contained in:
Luis Hebendanz 2024-03-25 00:32:03 +01:00
parent 9dbc71e446
commit e26d1052b6
8 changed files with 32 additions and 20 deletions

2
.envrc
View File

@ -2,7 +2,7 @@ if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4="
fi
watch_file .direnv/selected-shell
watch_file .direnv/selected-shell
if [ -e .direnv/selected-shell ]; then
use flake .#$(cat .direnv/selected-shell)

View File

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

View File

@ -1,5 +1,4 @@
# BUG: If this is enabled the devshell depends on clan_cli building successfully
# source_up
source_up
watch_file flake-module.nix shell.nix default.nix

View File

@ -22,9 +22,13 @@ mkShell {
] ++ devshellTestDeps;
shellHook = ''
export PATH=$(pwd)/bin:$PATH
export GIT_ROOT="$(git rev-parse --show-toplevel)"
export PKG_ROOT="$GIT_ROOT/pkgs/clan-cli"
# Add clan command to PATH
export PATH="$PKG_ROOT/bin":"$PATH"
# Needed for impure tests
ln -sfT ${clan-cli.nixpkgs} clan_cli/nixpkgs
ln -sfT ${clan-cli.nixpkgs} "$PKG_ROOT/clan_cli/nixpkgs"
'';
}

View File

@ -1,5 +1,4 @@
# See comment in clan-cli/.envrc
# source_up
source_up
watch_file flake-module.nix shell.nix default.nix

View File

@ -45,13 +45,16 @@ let
runtimeDependencies = [ ];
# Dependencies required for running tests
externalTestDeps = [
pytest # Testing framework
pytest-cov # Generate coverage reports
pytest-subprocess # fake the real subprocess behavior to make your tests more independent.
pytest-xdist # Run tests in parallel on multiple cores
pytest-timeout # Add timeouts to your tests
];
externalTestDeps =
externalPythonDeps
++ runtimeDependencies
++ [
pytest # Testing framework
pytest-cov # Generate coverage reports
pytest-subprocess # fake the real subprocess behavior to make your tests more independent.
pytest-xdist # Run tests in parallel on multiple cores
pytest-timeout # Add timeouts to your tests
];
# Dependencies required for running tests
testDependencies = runtimeDependencies ++ allPythonDeps ++ externalTestDeps;

View File

@ -30,6 +30,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

View File

@ -14,9 +14,7 @@
let
devshellTestDeps =
clan-vm-manager.externalPythonDeps
++ clan-vm-manager.externalTestDeps
++ clan-vm-manager.runtimeDependencies
clan-vm-manager.externalTestDeps
++ (with python3.pkgs; [
rope
mypy
@ -43,9 +41,13 @@ mkShell {
]);
shellHook = ''
export PATH=$(pwd)/bin:$PATH
export GIT_ROOT=$(git rev-parse --show-toplevel)
export PKG_ROOT=$GIT_ROOT/pkgs/clan-vm-manager
# Add clan-vm-manager command to PATH
export PATH="$PKG_ROOT/bin":"$PATH"
# Add clan-cli to the python path so that we can import it without building it in nix first
export PYTHONPATH=$(pwd)/../clan-cli:$PYTHONPATH
export PYTHONPATH="$GIT_ROOT/pkgs/clan-cli":"$PYTHONPATH"
'';
}