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;
|
||||
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)
|
||||
);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ self.lib.buildClan {
|
|||
machines = {
|
||||
"backup_server" = {
|
||||
clan.tags = [ "all" ];
|
||||
# ... rest of the machine config
|
||||
};
|
||||
"client_1_machine" = {
|
||||
clan.tags = [
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user