clan-cli: prepare source in extra derivation
Towards not rebuilding clan-cli on each commit
This commit is contained in:
parent
b1a4b9cabc
commit
a2648f2afb
@ -29,10 +29,19 @@ let
|
|||||||
];
|
];
|
||||||
|
|
||||||
checkPython = python3.withPackages (_ps: dependencies ++ testDependencies);
|
checkPython = python3.withPackages (_ps: dependencies ++ testDependencies);
|
||||||
|
|
||||||
|
# - vendor the jsonschema nix lib (copy instead of symlink).
|
||||||
|
# - lib.cleanSource prevents unnecessary rebuilds when `self` changes.
|
||||||
|
source = runCommand "clan-cli-source" { } ''
|
||||||
|
cp -r ${lib.cleanSource ./.} $out
|
||||||
|
chmod -R +w $out
|
||||||
|
rm $out/clan_cli/config/jsonschema
|
||||||
|
cp -r ${lib.cleanSource (self + /lib/jsonschema)} $out/clan_cli/config/jsonschema
|
||||||
|
'';
|
||||||
in
|
in
|
||||||
python3.pkgs.buildPythonPackage {
|
python3.pkgs.buildPythonPackage {
|
||||||
name = "clan-cli";
|
name = "clan-cli";
|
||||||
src = lib.cleanSource ./.;
|
src = source;
|
||||||
format = "pyproject";
|
format = "pyproject";
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
setuptools
|
setuptools
|
||||||
@ -40,16 +49,11 @@ python3.pkgs.buildPythonPackage {
|
|||||||
];
|
];
|
||||||
propagatedBuildInputs = dependencies;
|
propagatedBuildInputs = dependencies;
|
||||||
|
|
||||||
preBuild = ''
|
|
||||||
rm ./clan_cli/config/jsonschema
|
|
||||||
cp -r ${self}/lib/jsonschema ./clan_cli/config/jsonschema
|
|
||||||
'';
|
|
||||||
|
|
||||||
passthru.tests = {
|
passthru.tests = {
|
||||||
clan-mypy = runCommand "clan-mypy" { } ''
|
clan-mypy = runCommand "clan-mypy" { } ''
|
||||||
cp -r ${self} ./flake
|
cp -r ${source} ./src
|
||||||
chmod +w -R ./flake
|
chmod +w -R ./src
|
||||||
cd ./flake/pkgs/clan-cli
|
cd ./src
|
||||||
${checkPython}/bin/mypy .
|
${checkPython}/bin/mypy .
|
||||||
touch $out
|
touch $out
|
||||||
'';
|
'';
|
||||||
@ -57,9 +61,9 @@ python3.pkgs.buildPythonPackage {
|
|||||||
{
|
{
|
||||||
nativeBuildInputs = [ age zerotierone bubblewrap sops nix ];
|
nativeBuildInputs = [ age zerotierone bubblewrap sops nix ];
|
||||||
} ''
|
} ''
|
||||||
cp -r ${self} ./flake
|
cp -r ${source} ./src
|
||||||
chmod +w -R ./flake
|
chmod +w -R ./src
|
||||||
cd ./flake/pkgs/clan-cli
|
cd ./src
|
||||||
${checkPython}/bin/python -m pytest ./tests
|
${checkPython}/bin/python -m pytest ./tests
|
||||||
touch $out
|
touch $out
|
||||||
'';
|
'';
|
||||||
|
Loading…
Reference in New Issue
Block a user