clan-cli: initialize python project from template

clan-cli: remove unnecessary unit test file

clan-cli: fix shell.nix too stateful

clan-cli: remove conftest.py

clan-cli: fix flake-module.nix
This commit is contained in:
DavHau
2023-07-20 18:07:27 +02:00
committed by Jörg Thalheim
parent fb394f29ae
commit 9906d12384
6 changed files with 197 additions and 10 deletions

47
pkgs/clan-cli/shell.nix Normal file
View File

@@ -0,0 +1,47 @@
{ pkgs ? import <nixpkgs> { }
, system ? builtins.currentSystem
,
}:
let
lib = pkgs.lib;
python3 = pkgs.python3;
package = import ./default.nix {
inherit lib python3;
};
pythonWithDeps = python3.withPackages (
ps:
package.propagatedBuildInputs
++ package.devDependencies
++ [
ps.pip
]
);
checkScript = pkgs.writeScriptBin "check" ''
nix build -f . tests.check -L "$@"
'';
devShell = pkgs.mkShell {
packages = [
pkgs.ruff
pythonWithDeps
];
# sets up an editable install and add enty points to $PATH
shellHook = ''
tmp_path=$(realpath ./.pythonenv)
repo_root=$(realpath .)
rm -rf $tmp_path
mkdir -p "$tmp_path/${pythonWithDeps.sitePackages}"
${pythonWithDeps.interpreter} -m pip install \
--quiet \
--disable-pip-version-check \
--no-index \
--no-build-isolation \
--prefix "$tmp_path" \
--editable $repo_root
export PATH="$tmp_path/bin:${checkScript}/bin:$PATH"
export PYTHONPATH="$repo_root:$tmp_path/${pythonWithDeps.sitePackages}"
'';
};
in
devShell