remove some references to config in options

This commit is contained in:
DavHau
2025-04-03 17:22:03 +07:00
parent e897399e34
commit a88167f456
11 changed files with 28 additions and 6 deletions

View File

@@ -9,7 +9,7 @@ in
options.clan.borgbackup-static = { options.clan.borgbackup-static = {
excludeMachines = lib.mkOption { excludeMachines = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
example = [ config.clan.core.settings.machine.name ]; example = lib.literalExpression "[ config.clan.core.settings.machine.name ]";
default = [ ]; default = [ ];
description = '' description = ''
Machines that should not be backuped. Machines that should not be backuped.
@@ -20,7 +20,7 @@ in
}; };
includeMachines = lib.mkOption { includeMachines = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
example = [ config.clan.core.settings.machine.name ]; example = lib.literalExpression "[ config.clan.core.settings.machine.name ]";
default = [ ]; default = [ ];
description = '' description = ''
Machines that should be backuped. Machines that should be backuped.

View File

@@ -8,6 +8,12 @@
[ ] [ ]
else else
[ config.clan.core.settings.machine.name ]; [ config.clan.core.settings.machine.name ];
defaultText = lib.literalExpression ''
if config.clan.static-hosts.topLevelDomain != "" then
[ ]
else
[ config.clan.core.settings.machine.name ];
'';
description = "Hosts that should be excluded"; description = "Hosts that should be excluded";
}; };
topLevelDomain = lib.mkOption { topLevelDomain = lib.mkOption {

View File

@@ -48,7 +48,7 @@ in
options.clan.syncthing-static-peers = { options.clan.syncthing-static-peers = {
excludeMachines = lib.mkOption { excludeMachines = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
example = [ config.clan.core.settings.machine.name ]; example = lib.literalExpression "[ config.clan.core.settings.machine.name ]";
default = [ ]; default = [ ];
description = '' description = ''
Machines that should not be added. Machines that should not be added.

View File

@@ -28,6 +28,7 @@ in
excludeHosts = lib.mkOption { excludeHosts = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
default = [ config.clan.core.settings.machine.name ]; default = [ config.clan.core.settings.machine.name ];
defaultText = lib.literalExpression "[ config.clan.core.settings.machine.name ]";
description = "Hosts that should be excluded"; description = "Hosts that should be excluded";
}; };
networkIps = lib.mkOption { networkIps = lib.mkOption {

View File

@@ -35,6 +35,7 @@ in
excludeHosts = lib.mkOption { excludeHosts = lib.mkOption {
type = listOf str; type = listOf str;
default = [ config.clan.core.settings.machine.name ]; default = [ config.clan.core.settings.machine.name ];
defaultText = lib.literalExpression "[ config.clan.core.settings.machine.name ]";
description = "Hosts that should be excluded"; description = "Hosts that should be excluded";
}; };
networkIps = lib.mkOption { networkIps = lib.mkOption {

View File

@@ -11,6 +11,7 @@
name = lib.mkOption { name = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = name; default = name;
defaultText = "attribute name of the backup provider";
description = '' description = ''
Name of the backup provider Name of the backup provider
''; '';

View File

@@ -47,6 +47,7 @@
name = lib.mkOption { name = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = service.config._module.args.name; default = service.config._module.args.name;
defaultText = "attribute name of the service";
description = '' description = ''
Namespace of the service Namespace of the service
''; '';
@@ -97,6 +98,7 @@
name of the secret name of the secret
''; '';
default = secret.config._module.args.name; default = secret.config._module.args.name;
defaultText = "attribute name of the secret";
}; };
path = lib.mkOption { path = lib.mkOption {
type = lib.types.path; type = lib.types.path;
@@ -111,6 +113,7 @@
groups = lib.mkOption { groups = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
default = config.clan.core.sops.defaultGroups; default = config.clan.core.sops.defaultGroups;
defaultText = lib.literalExpression "config.clan.core.sops.defaultGroups";
description = '' description = ''
Groups to decrypt the secret for. By default we always use the user's key. Groups to decrypt the secret for. By default we always use the user's key.
''; '';
@@ -133,6 +136,7 @@
name of the fact name of the fact
''; '';
default = fact.config._module.args.name; default = fact.config._module.args.name;
defaultText = "attribute name of the fact";
}; };
path = lib.mkOption { path = lib.mkOption {
type = lib.types.path; type = lib.types.path;
@@ -145,10 +149,10 @@
defaultText = lib.literalExpression "\${config.clan.core.settings.directory}/machines/\${config.clan.core.settings.machine.name}/facts/\${fact.config._module.args.name}"; defaultText = lib.literalExpression "\${config.clan.core.settings.directory}/machines/\${config.clan.core.settings.machine.name}/facts/\${fact.config._module.args.name}";
}; };
value = lib.mkOption { value = lib.mkOption {
defaultText = lib.literalExpression "\${config.clan.core.settings.directory}/\${fact.config.path}";
type = lib.types.nullOr lib.types.str; type = lib.types.nullOr lib.types.str;
default = default =
if builtins.pathExists fact.config.path then lib.strings.fileContents fact.config.path else null; if builtins.pathExists fact.config.path then lib.strings.fileContents fact.config.path else null;
defaultText = "null if fact.config.path does not exist, else the content of the file";
}; };
}; };
}) })

View File

@@ -87,6 +87,7 @@
name = lib.mkOption { name = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = service.config._module.args.name; default = service.config._module.args.name;
defaultText = "attribute name of the service";
description = '' description = ''
Namespace of the service Namespace of the service
''; '';
@@ -178,6 +179,7 @@
name of the secret name of the secret
''; '';
default = secret.config._module.args.name; default = secret.config._module.args.name;
defaultText = "attribute name of the secret";
}; };
path = lib.mkOption { path = lib.mkOption {
type = lib.types.str; type = lib.types.str;
@@ -185,12 +187,14 @@
path to a secret which is generated by the generator path to a secret which is generated by the generator
''; '';
default = config.clan.core.facts.secretPathFunction secret; default = config.clan.core.facts.secretPathFunction secret;
defaultText = lib.literalExpression "config.clan.core.facts.secretPathFunction secret";
}; };
} }
// lib.optionalAttrs (config.clan.core.facts.secretModule == "clan_cli.facts.secret_modules.sops") { // lib.optionalAttrs (config.clan.core.facts.secretModule == "clan_cli.facts.secret_modules.sops") {
groups = lib.mkOption { groups = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
default = config.clan.core.sops.defaultGroups; default = config.clan.core.sops.defaultGroups;
defaultText = lib.literalExpression "config.clan.core.sops.defaultGroups";
description = '' description = ''
Groups to decrypt the secret for. By default we always use the user's key. Groups to decrypt the secret for. By default we always use the user's key.
''; '';
@@ -213,6 +217,7 @@
name of the public fact name of the public fact
''; '';
default = fact.config._module.args.name; default = fact.config._module.args.name;
defaultText = "attribute name of the public fact";
}; };
path = lib.mkOption { path = lib.mkOption {
type = lib.types.path; type = lib.types.path;

View File

@@ -95,7 +95,7 @@ in
description = '' description = ''
the name of the clan the name of the clan
''; '';
# Set by the flake, so it's read-only in the maschine # Set by the flake, so it's read-only in the machine
readOnly = true; readOnly = true;
}; };
icon = lib.mkOption { icon = lib.mkOption {
@@ -103,7 +103,7 @@ in
description = '' description = ''
the location of the clan icon the location of the clan icon
''; '';
# Set by the flake, so it's read-only in the maschine # Set by the flake, so it's read-only in the machine
readOnly = true; readOnly = true;
}; };
machine = mkOption { machine = mkOption {

View File

@@ -19,6 +19,7 @@
name = lib.mkOption { name = lib.mkOption {
type = lib.types.strMatching "^[a-zA-Z0-9_-]+$"; type = lib.types.strMatching "^[a-zA-Z0-9_-]+$";
default = name; default = name;
defaultText = "attribute name of the state";
description = '' description = ''
Name of the state Name of the state
''; '';
@@ -43,6 +44,7 @@
preBackupCommand = lib.mkOption { preBackupCommand = lib.mkOption {
type = lib.types.nullOr lib.types.str; type = lib.types.nullOr lib.types.str;
default = if config.preBackupScript == null then null else "pre-backup-${name}"; default = if config.preBackupScript == null then null else "pre-backup-${name}";
defaultText = lib.literalExpression ''null if preBackupScript set, or else "pre-backup-${name}"'';
readOnly = true; readOnly = true;
description = '' description = ''
Use this command in backup providers. It contains the content of preBackupScript. Use this command in backup providers. It contains the content of preBackupScript.
@@ -73,6 +75,7 @@
preRestoreCommand = lib.mkOption { preRestoreCommand = lib.mkOption {
type = lib.types.nullOr lib.types.str; type = lib.types.nullOr lib.types.str;
default = if config.preRestoreScript == null then null else "pre-restore-${name}"; default = if config.preRestoreScript == null then null else "pre-restore-${name}";
defaultText = lib.literalExpression ''null if preRestoreScript set, or else "pre-restore-${name}"'';
readOnly = true; readOnly = true;
description = '' description = ''
This command can be called to restore the state dir from a backup. This command can be called to restore the state dir from a backup.

View File

@@ -25,6 +25,7 @@
command = lib.mkOption { command = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
default = [ (lib.getExe pkgs.foot) ]; default = [ (lib.getExe pkgs.foot) ];
defaultText = "executable of pkgs.foot";
description = "Commands that waypipe should run"; description = "Commands that waypipe should run";
}; };
}; };