1
0
forked from clan/clan-core

Inventory: restructure folders

This commit is contained in:
Johannes Kirschbauer 2024-06-26 15:16:20 +02:00
parent 3777a4cf02
commit 2535fdcb12
Signed by: hsjobeki
SSH Key Fingerprint: SHA256:vX3utDqig7Ph5L0JPv87ZTPb/w7cMzREKVZzzLFg9qU
9 changed files with 11 additions and 15 deletions

View File

@ -18,7 +18,7 @@ rec {
content = getReadme modulename;
parts = lib.splitString "---" content;
# Partition the parts into the first part (the readme content) and the rest (the metadata)
parsed = builtins.partition ({ index }: if index >= 2 then false else true) (
parsed = builtins.partition ({ index, ... }: if index >= 2 then false else true) (
lib.filter ({ index, ... }: index != 0) (lib.imap0 (index: part: { inherit index part; }) parts)
);

View File

@ -19,6 +19,7 @@ self.lib.buildClan {
machines = {
"backup_server" = {
clan.tags = [ "all" ];
# ... rest of the machine config
};
"client_1_machine" = {
clan.tags = [

View File

@ -1,34 +1,29 @@
{ ... }:
{ self, ... }:
{
flake.inventory = import ./example.nix { inherit self; };
perSystem =
{ pkgs, config, ... }:
{
packages.inventory-schema = pkgs.stdenv.mkDerivation {
name = "inventory-schema";
src = ./src;
buildInputs = [ pkgs.cue ];
installPhase = ''
mkdir -p $out
'';
devShells.inventory-schema = pkgs.mkShell {
inputsFrom = [ config.checks.inventory-schema-checks ];
};
devShells.inventory-schema = pkgs.mkShell { inputsFrom = [ config.packages.inventory-schema ]; };
checks.inventory-schema-checks = pkgs.stdenv.mkDerivation {
name = "inventory-schema-checks";
src = ./src;
src = ./.;
buildInputs = [ pkgs.cue ];
buildPhase = ''
echo "Running inventory tests..."
# Cue is easier to run in the same directory as the schema
cd spec
echo "Export cue as json-schema..."
cue export --out openapi root.cue
echo "Validate test/*.json against inventory-schema..."
test_dir="test"
test_dir="../examples"
for file in "$test_dir"/*; do
# Check if the item is a file
if [ -f "$file" ]; then