From ac95878eadb37b5f7afd16ccbc3beb5c94b7a81d Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Tue, 16 Jul 2024 13:56:53 +0200 Subject: [PATCH] Inventory: init: deployment info for machines --- flakeModules/clan.nix | 2 +- lib/build-clan/default.nix | 7 +++++++ lib/inventory/build-inventory/default.nix | 2 +- lib/inventory/build-inventory/interface.nix | 11 +++++++++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/flakeModules/clan.nix b/flakeModules/clan.nix index 01739305a..f8a60d1fb 100644 --- a/flakeModules/clan.nix +++ b/flakeModules/clan.nix @@ -120,8 +120,8 @@ in machines pkgsForSystem meta + inventory ; - inventory = (lib.traceValSeq cfg.inventory); }; }; _file = __curPos.file; diff --git a/lib/build-clan/default.nix b/lib/build-clan/default.nix index 82c8f9c36..7b6e4969e 100644 --- a/lib/build-clan/default.nix +++ b/lib/build-clan/default.nix @@ -72,6 +72,13 @@ let "nixpkgs" "hostSystem" ] null config; + + deploymentInfo.targetHost = lib.attrByPath [ + "clan" + "core" + "networking" + "targetHost" + ] null config; } ) machines; } diff --git a/lib/inventory/build-inventory/default.nix b/lib/inventory/build-inventory/default.nix index a24eaa053..413c79766 100644 --- a/lib/inventory/build-inventory/default.nix +++ b/lib/inventory/build-inventory/default.nix @@ -24,7 +24,7 @@ let availableTags = lib.foldlAttrs ( acc: _: v: v.tags or [ ] ++ acc - ) [ ] (lib.traceValSeq inventory.machines); + ) [ ] (inventory.machines); tagMembers = builtins.attrNames ( lib.filterAttrs (_n: v: builtins.elem tag v.tags or [ ]) inventory.machines diff --git a/lib/inventory/build-inventory/interface.nix b/lib/inventory/build-inventory/interface.nix index a64b376e4..cc121c946 100644 --- a/lib/inventory/build-inventory/interface.nix +++ b/lib/inventory/build-inventory/interface.nix @@ -49,6 +49,17 @@ in default = null; type = types.nullOr types.str; }; + deploymentInfo = lib.mkOption { + default = { }; + type = types.submodule { + options = { + targetHost = lib.mkOption { + default = null; + type = types.nullOr types.str; + }; + }; + }; + }; }; } );