feat(nix_models): replace inventory model by holistic clan model

This commit is contained in:
Johannes Kirschbauer
2025-05-27 10:27:17 +02:00
parent 111983b508
commit 8eb2ad6c6d
5 changed files with 22 additions and 12 deletions

View File

@@ -1,4 +1,9 @@
{ self, inputs, ... }:
{
self,
inputs,
options,
...
}:
let
inputOverrides = builtins.concatStringsSep " " (
builtins.map (input: " --override-input ${input} ${inputs.${input}}") (builtins.attrNames inputs)
@@ -28,6 +33,7 @@ in
legacyPackages.schemas = (
import ./schemas {
flakeOptions = options;
inherit
pkgs
self

View File

@@ -2,6 +2,7 @@
self,
self',
pkgs,
flakeOptions,
...
}:
let
@@ -21,6 +22,8 @@ let
import ../build-inventory/interface.nix { inherit (self) clanLib; }
);
clanSchema = jsonLib.parseOptions (flakeOptions.clan.type.getSubOptions [ "clan" ]) { };
renderSchema = pkgs.writers.writePython3Bin "render-schema" {
flakeIgnore = [
"F401"
@@ -28,12 +31,12 @@ let
];
} ./render_schema.py;
inventory-schema-abstract = pkgs.stdenv.mkDerivation {
name = "inventory-schema-files";
clan-schema-abstract = pkgs.stdenv.mkDerivation {
name = "clan-schema-files";
buildInputs = [ pkgs.cue ];
src = ./.;
buildPhase = ''
export SCHEMA=${builtins.toFile "inventory-schema.json" (builtins.toJSON inventorySchema)}
export SCHEMA=${builtins.toFile "clan-schema.json" (builtins.toJSON clanSchema)}
cp $SCHEMA schema.json
# Also generate a CUE schema version that is derived from the JSON schema
cue import -f -p compose -l '#Root:' schema.json
@@ -45,11 +48,13 @@ let
in
{
inherit
flakeOptions
frontMatterSchema
clanSchema
inventorySchema
modulesSchema
renderSchema
inventory-schema-abstract
clan-schema-abstract
;
# Inventory schema, with the modules schema added per role