From cc2cce0cce491d83165708ac95cc2c45efa19fb6 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 20 Jul 2024 22:15:48 +0200 Subject: [PATCH] cluster/lib: implement injectNixosConfigForServices to select individual services --- cluster/lib/inject-nixos-config.nix | 6 +++--- cluster/lib/services.nix | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cluster/lib/inject-nixos-config.nix b/cluster/lib/inject-nixos-config.nix index 6e5add1..4523b96 100644 --- a/cluster/lib/inject-nixos-config.nix +++ b/cluster/lib/inject-nixos-config.nix @@ -2,9 +2,9 @@ with lib; { - options.out.injectNixosConfig = mkOption { - description = "NixOS configuration to inject into the given host."; - type = with types; functionTo raw; + options.out = mkOption { + description = "Output functions."; + type = with types; lazyAttrsOf (functionTo raw); default = const []; }; } diff --git a/cluster/lib/services.nix b/cluster/lib/services.nix index b500f1b..4e9f8bc 100644 --- a/cluster/lib/services.nix +++ b/cluster/lib/services.nix @@ -39,7 +39,11 @@ in default = {}; }; - config.out.injectNixosConfig = hostName: (lib.flatten (lib.mapAttrsToList (getHostConfigurations hostName) config.services)) ++ [ - introspectionModule - ]; + config.out = { + injectNixosConfigForServices = services: hostName: (lib.flatten (lib.mapAttrsToList (getHostConfigurations hostName) (lib.getAttrs services config.services))) ++ [ + introspectionModule + ]; + + injectNixosConfig = config.out.injectNixosConfigForServices (lib.attrNames config.services); + }; }