PropagatedBuild inputs workaround

This commit is contained in:
Johannes Kirschbauer
2024-07-26 15:23:25 +02:00
parent c648e647bf
commit b015f1f123
7 changed files with 35 additions and 8 deletions

View File

@@ -54,9 +54,11 @@
module-docs =
pkgs.runCommand "rendered"
{
nativeBuildInputs = [
buildInputs = [
pkgs.python3
self'.packages.clan-cli
# TODO: see postFixup clan-cli/default.nix:L188
self'.packages.clan-cli.propagatedBuildInputs
];
}
''

View File

@@ -94,7 +94,14 @@ python3.pkgs.buildPythonApplication rec {
# that all necessary dependencies are consistently available both
# at build time and runtime,
buildInputs = allPythonDeps ++ runtimeDependencies;
propagatedBuildInputs = allPythonDeps ++ runtimeDependencies;
propagatedBuildInputs =
allPythonDeps
++ runtimeDependencies
++ [
# TODO: see postFixup clan-cli/default.nix:L188
clan-cli.propagatedBuildInputs
];
# also re-expose dependencies so we test them in CI
passthru = {

View File

@@ -153,7 +153,7 @@ class ServiceSingleDisk:
class Service:
borgbackup: dict[str, ServiceBorgbackup] = field(default_factory = dict)
packages: dict[str, ServicePackage] = field(default_factory = dict)
single_disk: dict[str, ServiceSingleDisk] = field(default_factory = dict, metadata = {"original_name": "single-disk"})
single_disk: dict[str, ServiceSingleDisk] = field(default_factory = dict, metadata = {"alias": "single-disk"})
@dataclass

View File

@@ -30,7 +30,7 @@
let
pythonDependencies = [
argcomplete # Enables shell completions
pydantic
pydantic # Dataclass deserialisation / validation / schemas
];
# load nixpkgs runtime dependencies from a json file
@@ -183,6 +183,7 @@ python3.pkgs.buildPythonApplication {
'';
# Clean up after the package to avoid leaking python packages into a devshell
# TODO: factor seperate cli / API packages
postFixup = ''
rm $out/nix-support/propagated-build-inputs
'';

View File

@@ -62,7 +62,12 @@
name = "clan-cli-docs";
src = ./.;
buildInputs = [ pkgs.python3 ];
buildInputs = [
# TODO: see postFixup clan-cli/default.nix:L188
pkgs.python3
self'.packages.clan-cli.propagatedBuildInputs
];
installPhase = ''
${self'.packages.classgen}/bin/classgen ${self'.packages.inventory-schema}/schema.json ./clan_cli/inventory/classes.py
@@ -77,7 +82,12 @@
name = "clan-ts-api";
src = ./.;
buildInputs = [ pkgs.python3 ];
buildInputs = [
pkgs.python3
# TODO: see postFixup clan-cli/default.nix:L188
self'.packages.clan-cli.propagatedBuildInputs
];
installPhase = ''
${self'.packages.classgen}/bin/classgen ${self'.packages.inventory-schema}/schema.json ./clan_cli/inventory/classes.py

View File

@@ -93,7 +93,14 @@ python3.pkgs.buildPythonApplication rec {
# that all necessary dependencies are consistently available both
# at build time and runtime,
buildInputs = allPythonDeps ++ runtimeDependencies;
propagatedBuildInputs = allPythonDeps ++ runtimeDependencies;
propagatedBuildInputs =
allPythonDeps
++ runtimeDependencies
++ [
# TODO: see postFixup clan-cli/default.nix:L188
clan-cli.propagatedBuildInputs
];
# also re-expose dependencies so we test them in CI
passthru = {

View File

@@ -245,7 +245,7 @@ def generate_dataclass(schema: dict[str, Any], class_name: str = root_class) ->
field_meta = None
if field_name != prop:
field_meta = f"""{{"original_name": "{prop}"}}"""
field_meta = f"""{{"alias": "{prop}"}}"""
finalize_field = partial(get_field_def, field_name, field_meta)