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
This commit is contained in:
DavHau
2025-07-15 13:41:05 +07:00
parent 66a6758db4
commit b91158f454
3 changed files with 20 additions and 3 deletions

View File

@@ -26,6 +26,7 @@ in
++ lib.optionals (_class == "nixos") [ ++ lib.optionals (_class == "nixos") [
./secret/password-store.nix ./secret/password-store.nix
]; ];
options.clan.core.vars = lib.mkOption { options.clan.core.vars = lib.mkOption {
description = '' description = ''
Generated Variables Generated Variables
@@ -36,7 +37,14 @@ in
- generate secrets like private keys automatically when they are needed - generate secrets like private keys automatically when they are needed
- output multiple values like private and public keys simultaneously - 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 = { config = {

View File

@@ -68,7 +68,6 @@ in
default = generator.config._module.args.name; default = generator.config._module.args.name;
defaultText = "Name of the generator"; defaultText = "Name of the generator";
}; };
dependencies = mkOption { dependencies = mkOption {
description = '' description = ''
A list of other generators that this generator depends on. 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`** **A file `file1` of a generator named `dep1` will be available via `$in/dep1/file1`**
''; '';
type = listOf str; type = config.settings.dependenciesType;
default = [ ]; default = [ ];
}; };
migrateFact = mkOption { migrateFact = mkOption {

View File

@@ -65,4 +65,14 @@
Set it to pkgs.pass for GPG or pkgs.passage for age encryption. 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;
};
} }