From b91158f454aa3d256e1c339086d186155d10ee4c Mon Sep 17 00:00:00 2001 From: DavHau Date: Tue, 15 Jul 2025 13:41:05 +0700 Subject: [PATCH] vars/interface: make type of dependencies configurable One vars get lifted to the global scope, dependencies need to be structured differently, eg. categorized by instances --- nixosModules/clanCore/vars/default.nix | 10 +++++++++- nixosModules/clanCore/vars/interface.nix | 3 +-- nixosModules/clanCore/vars/settings-opts.nix | 10 ++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/nixosModules/clanCore/vars/default.nix b/nixosModules/clanCore/vars/default.nix index 42532b284..35d8f775c 100644 --- a/nixosModules/clanCore/vars/default.nix +++ b/nixosModules/clanCore/vars/default.nix @@ -26,6 +26,7 @@ in ++ lib.optionals (_class == "nixos") [ ./secret/password-store.nix ]; + options.clan.core.vars = lib.mkOption { description = '' Generated Variables @@ -36,7 +37,14 @@ in - generate secrets like private keys automatically when they are needed - output multiple values like private and public keys simultaneously ''; - type = submodule { imports = [ ./interface.nix ]; }; + type = submodule { + imports = [ + ./interface.nix + { + settings.dependenciesType = lib.types.listOf lib.types.str; + } + ]; + }; }; config = { diff --git a/nixosModules/clanCore/vars/interface.nix b/nixosModules/clanCore/vars/interface.nix index 87506be6b..3ca9aa4aa 100644 --- a/nixosModules/clanCore/vars/interface.nix +++ b/nixosModules/clanCore/vars/interface.nix @@ -68,7 +68,6 @@ in default = generator.config._module.args.name; defaultText = "Name of the generator"; }; - dependencies = mkOption { description = '' A list of other generators that this generator depends on. @@ -78,7 +77,7 @@ in **A file `file1` of a generator named `dep1` will be available via `$in/dep1/file1`** ''; - type = listOf str; + type = config.settings.dependenciesType; default = [ ]; }; migrateFact = mkOption { diff --git a/nixosModules/clanCore/vars/settings-opts.nix b/nixosModules/clanCore/vars/settings-opts.nix index 226888111..47f5a31e7 100644 --- a/nixosModules/clanCore/vars/settings-opts.nix +++ b/nixosModules/clanCore/vars/settings-opts.nix @@ -65,4 +65,14 @@ Set it to pkgs.pass for GPG or pkgs.passage for age encryption. ''; }; + + dependenciesType = lib.mkOption { + type = lib.types.raw; + description = '' + The type of the `dependencies` option. + ''; + internal = true; + readOnly = true; + visible = false; + }; }