1
0
forked from clan/clan-core

select-shell: Fix breakage with previous shell.nix change

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=" source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4="
fi fi
watch_file .direnv/selected-shell watch_file .direnv/selected-shell
if [ -e .direnv/selected-shell ]; then if [ -e .direnv/selected-shell ]; then
use flake .#$(cat .direnv/selected-shell) use flake .#$(cat .direnv/selected-shell)

View File

@ -10,7 +10,8 @@
treefmt.programs.mypy.enable = true; treefmt.programs.mypy.enable = true;
treefmt.programs.mypy.directories = { treefmt.programs.mypy.directories = {
"pkgs/clan-cli".extraPythonPackages = self'.packages.clan-cli.testDependencies; "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 = { 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 watch_file flake-module.nix shell.nix default.nix

View File

@ -22,9 +22,13 @@ mkShell {
] ++ devshellTestDeps; ] ++ devshellTestDeps;
shellHook = '' 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 # 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 watch_file flake-module.nix shell.nix default.nix

View File

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

View File

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

View File

@ -14,9 +14,7 @@
let let
devshellTestDeps = devshellTestDeps =
clan-vm-manager.externalPythonDeps clan-vm-manager.externalTestDeps
++ clan-vm-manager.externalTestDeps
++ clan-vm-manager.runtimeDependencies
++ (with python3.pkgs; [ ++ (with python3.pkgs; [
rope rope
mypy mypy
@ -43,9 +41,13 @@ mkShell {
]); ]);
shellHook = '' 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 # 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"
''; '';
} }