forked from clan/clan-core
Inventory: restructure folders
This commit is contained in:
parent
3777a4cf02
commit
2535fdcb12
@ -18,7 +18,7 @@ rec {
|
|||||||
content = getReadme modulename;
|
content = getReadme modulename;
|
||||||
parts = lib.splitString "---" content;
|
parts = lib.splitString "---" content;
|
||||||
# Partition the parts into the first part (the readme content) and the rest (the metadata)
|
# 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)
|
lib.filter ({ index, ... }: index != 0) (lib.imap0 (index: part: { inherit index part; }) parts)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ self.lib.buildClan {
|
|||||||
machines = {
|
machines = {
|
||||||
"backup_server" = {
|
"backup_server" = {
|
||||||
clan.tags = [ "all" ];
|
clan.tags = [ "all" ];
|
||||||
|
# ... rest of the machine config
|
||||||
};
|
};
|
||||||
"client_1_machine" = {
|
"client_1_machine" = {
|
||||||
clan.tags = [
|
clan.tags = [
|
||||||
|
@ -1,34 +1,29 @@
|
|||||||
{ ... }:
|
{ self, ... }:
|
||||||
{
|
{
|
||||||
|
|
||||||
|
flake.inventory = import ./example.nix { inherit self; };
|
||||||
perSystem =
|
perSystem =
|
||||||
{ pkgs, config, ... }:
|
{ pkgs, config, ... }:
|
||||||
{
|
{
|
||||||
packages.inventory-schema = pkgs.stdenv.mkDerivation {
|
devShells.inventory-schema = pkgs.mkShell {
|
||||||
name = "inventory-schema";
|
inputsFrom = [ config.checks.inventory-schema-checks ];
|
||||||
src = ./src;
|
|
||||||
|
|
||||||
buildInputs = [ pkgs.cue ];
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells.inventory-schema = pkgs.mkShell { inputsFrom = [ config.packages.inventory-schema ]; };
|
|
||||||
|
|
||||||
checks.inventory-schema-checks = pkgs.stdenv.mkDerivation {
|
checks.inventory-schema-checks = pkgs.stdenv.mkDerivation {
|
||||||
name = "inventory-schema-checks";
|
name = "inventory-schema-checks";
|
||||||
src = ./src;
|
src = ./.;
|
||||||
buildInputs = [ pkgs.cue ];
|
buildInputs = [ pkgs.cue ];
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
echo "Running inventory tests..."
|
echo "Running inventory tests..."
|
||||||
|
# Cue is easier to run in the same directory as the schema
|
||||||
|
cd spec
|
||||||
|
|
||||||
echo "Export cue as json-schema..."
|
echo "Export cue as json-schema..."
|
||||||
cue export --out openapi root.cue
|
cue export --out openapi root.cue
|
||||||
|
|
||||||
echo "Validate test/*.json against inventory-schema..."
|
echo "Validate test/*.json against inventory-schema..."
|
||||||
|
|
||||||
test_dir="test"
|
test_dir="../examples"
|
||||||
for file in "$test_dir"/*; do
|
for file in "$test_dir"/*; do
|
||||||
# Check if the item is a file
|
# Check if the item is a file
|
||||||
if [ -f "$file" ]; then
|
if [ -f "$file" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user