From bbcb0c168a0ac582f80df9795096327acf8836a3 Mon Sep 17 00:00:00 2001 From: Valentin Gagarin Date: Sat, 3 May 2025 16:22:20 +0200 Subject: [PATCH 1/2] models: small fixups --- projects/types.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/types.nix b/projects/types.nix index 0d1b7d27a..09f59ec1f 100644 --- a/projects/types.nix +++ b/projects/types.nix @@ -23,6 +23,7 @@ in ( name: mkOption { + description = "subgrants under the ${name} fund"; type = listOf str; default = [ ]; } @@ -105,7 +106,7 @@ in }; tests = mkOption { description = "at least one test for the example"; - type = nonEmtpyAttrs test; + type = nonEmtpyAttrs (nullOr test); }; links = mkOption { description = "links to related resources"; @@ -115,5 +116,5 @@ in }; }; - test = with types; nullOr (either deferredModule package); + test = with types; either deferredModule package; } From 2d23c41c7aedc8a40aa57e260678a26bfcdc4335 Mon Sep 17 00:00:00 2001 From: Valentin Gagarin Date: Sat, 3 May 2025 16:23:28 +0200 Subject: [PATCH 2/2] models: add service type --- projects/types.nix | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/projects/types.nix b/projects/types.nix index 09f59ec1f..cb8a2ce90 100644 --- a/projects/types.nix +++ b/projects/types.nix @@ -116,5 +116,35 @@ in }; }; + # TODO: make use of modular services https://github.com/NixOS/nixpkgs/pull/372170 + service = + with types; + submodule ( + { name, ... }: + { + options = { + name = mkOption { + type = nullOr str; + default = name; + }; + module = mkOption { + type = moduleType; + }; + examples = mkOption { + type = nullOr (attrsOf (nullOr example)); + default = null; + }; + extensions = mkOption { + type = nullOr (attrsOf (nullOr plugin)); + default = null; + }; + links = mkOption { + type = attrsOf link; + default = { }; + }; + }; + }; + }; + test = with types; either deferredModule package; }