From 25c001c18222ab3779b02f66c707b621821731a7 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 22 Jul 2024 00:58:50 +0200 Subject: [PATCH] cluster/lib: implement simulacrum options --- cluster/default.nix | 1 + cluster/lib/service-module.nix | 18 ++++++++++++++++++ cluster/lib/testing.nix | 9 +++++++++ 3 files changed, 28 insertions(+) create mode 100644 cluster/lib/testing.nix diff --git a/cluster/default.nix b/cluster/default.nix index 97ab73c..548c3af 100644 --- a/cluster/default.nix +++ b/cluster/default.nix @@ -16,6 +16,7 @@ lib.evalModules { ./lib/port-magic-multi.nix ./lib/mesh.nix ./lib/secrets.nix + ./lib/testing.nix ./import-services.nix ]; diff --git a/cluster/lib/service-module.nix b/cluster/lib/service-module.nix index 3ef8c98..2fb07e7 100644 --- a/cluster/lib/service-module.nix +++ b/cluster/lib/service-module.nix @@ -52,6 +52,24 @@ in })); default = {}; }; + simulacrum = { + enable = mkEnableOption "testing this service in the Simulacrum"; + deps = mkOption { + description = "Other services to include."; + type = with types; listOf str; + default = []; + }; + settings = mkOption { + description = "NixOS test configuration."; + type = types.deferredModule; + default = {}; + }; + augments = mkOption { + description = "Cluster augments (will be propagated)."; + type = types.deferredModule; + default = {}; + }; + }; }; config.otherNodes = builtins.mapAttrs (const filterGroup) config.nodes; } diff --git a/cluster/lib/testing.nix b/cluster/lib/testing.nix new file mode 100644 index 0000000..6c96b37 --- /dev/null +++ b/cluster/lib/testing.nix @@ -0,0 +1,9 @@ +{ lib, ... }: + +{ + options.simulacrum = lib.mkOption { + description = "Whether we are in the Simulacrum."; + type = lib.types.bool; + default = false; + }; +}