feat(nix_models): replace inventory model by holistic clan model
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user