diff --git a/lib/build-clan/module.nix b/lib/build-clan/module.nix index e0c7767af..a523e5542 100644 --- a/lib/build-clan/module.nix +++ b/lib/build-clan/module.nix @@ -13,7 +13,6 @@ let specialArgs ; - # Final inventory inherit (config.clanInternals) inventory; inherit (clan-core.lib.inventory) buildInventory; @@ -88,8 +87,8 @@ let clan.core.clanDir = directory; # Inherited from clan wide settings # TODO: remove these - clan.core.clanName = config.inventory.meta.name; - clan.core.clanIcon = config.inventory.meta.icon; + clan.core.name = config.inventory.meta.name; + clan.core.icon = config.inventory.meta.icon; # Machine specific settings clan.core.machineName = name; diff --git a/lib/build-clan/tests.nix b/lib/build-clan/tests.nix index a4982b437..b231cdfdf 100644 --- a/lib/build-clan/tests.nix +++ b/lib/build-clan/tests.nix @@ -10,7 +10,6 @@ let inherit lib nixpkgs clan-core; self = ./.; }; - in ####### { diff --git a/lib/eval-clan-modules/default.nix b/lib/eval-clan-modules/default.nix index 814388d7e..ccef35868 100644 --- a/lib/eval-clan-modules/default.nix +++ b/lib/eval-clan-modules/default.nix @@ -12,7 +12,7 @@ let imports = (import (pkgs.path + "/nixos/modules/module-list.nix")) ++ [ { nixpkgs.hostPlatform = "x86_64-linux"; - clan.core.clanName = "dummy"; + clan.core.name = "dummy"; } ]; }; diff --git a/nixosModules/clanCore/metadata.nix b/nixosModules/clanCore/metadata.nix index d9947296b..6f037a8a0 100644 --- a/nixosModules/clanCore/metadata.nix +++ b/nixosModules/clanCore/metadata.nix @@ -1,11 +1,33 @@ { lib, pkgs, ... }: { + imports = [ + (lib.mkRemovedOptionModule [ + "clan" + "core" + "clanName" + ] "clanName has been removed. Use clan.core.name instead.") + (lib.mkRemovedOptionModule [ + "clan" + "core" + "clanIcon" + ] "clanIcon has been removed. Use clan.core.icon instead.") + ]; options.clan.core = { - clanName = lib.mkOption { + 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 { type = lib.types.nullOr lib.types.path; @@ -28,12 +50,6 @@ the location of the flake repo, used to calculate the location of facts and secrets ''; }; - clanIcon = lib.mkOption { - type = lib.types.nullOr lib.types.path; - description = '' - the location of the clan icon - ''; - }; machineName = lib.mkOption { type = lib.types.str; default = "nixos"; diff --git a/nixosModules/clanCore/vm.nix b/nixosModules/clanCore/vm.nix index 9bdf78b8f..cc6bc7ee0 100644 --- a/nixosModules/clanCore/vm.nix +++ b/nixosModules/clanCore/vm.nix @@ -249,8 +249,8 @@ in config = { # for clan vm inspect clan.core.vm.inspect = { - clan_name = config.clan.core.clanName; - machine_icon = config.clan.core.machineIcon or config.clan.core.clanIcon; + clan_name = config.clan.core.name; + machine_icon = config.clan.core.machineIcon or config.clan.core.icon; machine_name = config.clan.core.machineName; machine_description = config.clan.core.machineDescription; memory_size = config.clan.virtualisation.memorySize; diff --git a/nixosModules/clanCore/zerotier/default.nix b/nixosModules/clanCore/zerotier/default.nix index a26974b0b..a7bf34bfa 100644 --- a/nixosModules/clanCore/zerotier/default.nix +++ b/nixosModules/clanCore/zerotier/default.nix @@ -23,8 +23,8 @@ in }; name = lib.mkOption { type = lib.types.str; - default = config.clan.core.clanName; - defaultText = "config.clan.core.clanName"; + default = config.clan.core.name; + defaultText = "config.clan.core.name"; description = '' zerotier network name ''; diff --git a/pkgs/clan-cli/clan_cli/clan/inspect.py b/pkgs/clan-cli/clan_cli/clan/inspect.py index bf83c9b5b..c3ea61c1a 100644 --- a/pkgs/clan-cli/clan_cli/clan/inspect.py +++ b/pkgs/clan-cli/clan_cli/clan/inspect.py @@ -57,7 +57,7 @@ def inspect_flake(flake_url: str | Path, machine_name: str) -> FlakeConfig: # Get the Clan name cmd = nix_eval( [ - f'{flake_url}#clanInternals.machines."{system}"."{machine_name}".config.clan.core.clanName' + f'{flake_url}#clanInternals.machines."{system}"."{machine_name}".config.clan.core.name' ] ) res = run_cmd(cmd) @@ -66,7 +66,7 @@ def inspect_flake(flake_url: str | Path, machine_name: str) -> FlakeConfig: # Get the clan icon path cmd = nix_eval( [ - f'{flake_url}#clanInternals.machines."{system}"."{machine_name}".config.clan.core.clanIcon' + f'{flake_url}#clanInternals.machines."{system}"."{machine_name}".config.clan.core.icon' ] ) res = run_cmd(cmd) @@ -79,9 +79,9 @@ def inspect_flake(flake_url: str | Path, machine_name: str) -> FlakeConfig: cmd = nix_build( [ - f'{flake_url}#clanInternals.machines."{system}"."{machine_name}".config.clan.core.clanIcon' + f'{flake_url}#clanInternals.machines."{system}"."{machine_name}".config.clan.core.icon' ], - machine_gcroot(flake_url=str(flake_url)) / "clanIcon", + machine_gcroot(flake_url=str(flake_url)) / "icon", ) run_cmd(cmd) diff --git a/pkgs/clan-cli/clan_cli/config/machine.py b/pkgs/clan-cli/clan_cli/config/machine.py index 9155918c2..e52845118 100644 --- a/pkgs/clan-cli/clan_cli/config/machine.py +++ b/pkgs/clan-cli/clan_cli/config/machine.py @@ -18,7 +18,7 @@ def verify_machine_config( ) -> str | None: """ Verify that the machine evaluates successfully - Returns a tuple of (success, error_message) + Returns None, in case of success, or a String containing the error_message """ if config is None: config = config_for_machine(flake_dir, machine_name) diff --git a/pkgs/clan-cli/clan_cli/config/schema.py b/pkgs/clan-cli/clan_cli/config/schema.py index 20e007f1b..351130908 100644 --- a/pkgs/clan-cli/clan_cli/config/schema.py +++ b/pkgs/clan-cli/clan_cli/config/schema.py @@ -88,9 +88,9 @@ def machine_schema( [ clan-core.nixosModules.clanCore # potentially the config might affect submodule options, - # therefore we need to import it + # therefore we need to import it config - {{ clan.core.clanName = "fakeClan"; }} + {{ clan.core.name = "fakeClan"; }} ] # add all clan modules specified via clanImports ++ (map (name: clan-core.clanModules.${{name}}) config.clanImports or []);