Chore: move 'icon','name' into 'clan.core.settings' submodule

This commit is contained in:
Johannes Kirschbauer
2024-12-31 15:17:52 +01:00
parent c9a005b8d9
commit 1c6716674a
4 changed files with 41 additions and 25 deletions

View File

@@ -82,16 +82,14 @@ let
# Settings # Settings
clan.core.settings = { clan.core.settings = {
inherit directory; inherit directory;
inherit (config.inventory.meta) name icon;
machine = { machine = {
inherit name; inherit name;
}; };
}; };
# clan.core.settings.directory = directory;
# Inherited from clan wide settings # Inherited from clan wide settings
# TODO: remove these # TODO: remove these
clan.core.name = config.inventory.meta.name;
clan.core.icon = config.inventory.meta.icon;
# Machine specific settings # Machine specific settings
# clan.core.settings.machine.name = name; # clan.core.settings.machine.name = name;

View File

@@ -8,12 +8,12 @@ in
"clan" "clan"
"core" "core"
"clanName" "clanName"
] "clanName has been removed. Use clan.core.name instead.") ] "clanName has been removed. Use clan.core.settings.name instead.")
(lib.mkRemovedOptionModule [ (lib.mkRemovedOptionModule [
"clan" "clan"
"core" "core"
"clanIcon" "clanIcon"
] "clanIcon has been removed. Use clan.core.icon instead.") ] "clanIcon has been removed. Use clan.core.settings.icon instead.")
# The following options have been moved into clan.core.settings # The following options have been moved into clan.core.settings
(lib.mkRenamedOptionModule (lib.mkRenamedOptionModule
@@ -25,6 +25,24 @@ in
"directory" "directory"
] ]
) )
(lib.mkRenamedOptionModule
[ "clan" "core" "name" ]
[
"clan"
"core"
"settings"
"name"
]
)
(lib.mkRenamedOptionModule
[ "clan" "core" "icon" ]
[
"clan"
"core"
"settings"
"icon"
]
)
# The following options have been moved into clan.core.settings.machine # The following options have been moved into clan.core.settings.machine
(lib.mkRenamedOptionModule (lib.mkRenamedOptionModule
[ "clan" "core" "machineName" ] [ "clan" "core" "machineName" ]
@@ -52,13 +70,29 @@ in
the location of the flake repo, used to calculate the location of facts and secrets the location of the flake repo, used to calculate the location of facts and secrets
''; '';
}; };
name = lib.mkOption {
type = lib.types.str;
description = ''
the name of the clan
'';
# Set by the flake, so it's read-only in the maschine
readOnly = true;
};
icon = lib.mkOption {
type = lib.types.nullOr lib.types.path;
description = ''
the location of the clan icon
'';
# Set by the flake, so it's read-only in the maschine
readOnly = true;
};
machine = mkOption { machine = mkOption {
description = '' description = ''
Settings of the machine. Settings of the machine.
This is a read-only attribute-set available to the machines of the clan. This is a read-only attribute-set available to the machines of the clan.
''; '';
default = {}; default = { };
type = types.submodule { type = types.submodule {
options = { options = {
name = mkOption { name = mkOption {
@@ -75,22 +109,6 @@ in
}; };
}; };
name = lib.mkOption {
type = lib.types.str;
description = ''
the name of the clan
'';
# Set by the flake, so it's read-only in the maschine
readOnly = true;
};
icon = lib.mkOption {
type = lib.types.nullOr lib.types.path;
description = ''
the location of the clan icon
'';
# Set by the flake, so it's read-only in the maschine
readOnly = true;
};
machineIcon = lib.mkOption { machineIcon = lib.mkOption {
type = lib.types.nullOr lib.types.path; type = lib.types.nullOr lib.types.path;
default = null; default = null;

View File

@@ -250,8 +250,8 @@ in
config = { config = {
# for clan vm inspect # for clan vm inspect
clan.core.vm.inspect = { clan.core.vm.inspect = {
clan_name = config.clan.core.name; clan_name = config.clan.core.settings.name;
machine_icon = config.clan.core.machineIcon or config.clan.core.icon; machine_icon = config.clan.core.machineIcon or config.clan.core.settings.icon;
machine_name = config.clan.core.settings.machine.name; machine_name = config.clan.core.settings.machine.name;
machine_description = config.clan.core.machineDescription; machine_description = config.clan.core.machineDescription;
memory_size = config.clan.virtualisation.memorySize; memory_size = config.clan.virtualisation.memorySize;

View File

@@ -23,7 +23,7 @@ in
}; };
name = lib.mkOption { name = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = config.clan.core.name; default = config.clan.core.settings.name;
defaultText = "config.clan.core.name"; defaultText = "config.clan.core.name";
description = '' description = ''
zerotier network name zerotier network name