Merge pull request 'Clan-core: Rename clanName within Machines' (#1851) from hsjobeki/clan-core:hsjobeki-main into main
This commit is contained in:
@@ -13,7 +13,6 @@ let
|
|||||||
specialArgs
|
specialArgs
|
||||||
;
|
;
|
||||||
|
|
||||||
# Final inventory
|
|
||||||
inherit (config.clanInternals) inventory;
|
inherit (config.clanInternals) inventory;
|
||||||
|
|
||||||
inherit (clan-core.lib.inventory) buildInventory;
|
inherit (clan-core.lib.inventory) buildInventory;
|
||||||
@@ -88,8 +87,8 @@ let
|
|||||||
clan.core.clanDir = directory;
|
clan.core.clanDir = directory;
|
||||||
# Inherited from clan wide settings
|
# Inherited from clan wide settings
|
||||||
# TODO: remove these
|
# TODO: remove these
|
||||||
clan.core.clanName = config.inventory.meta.name;
|
clan.core.name = config.inventory.meta.name;
|
||||||
clan.core.clanIcon = config.inventory.meta.icon;
|
clan.core.icon = config.inventory.meta.icon;
|
||||||
|
|
||||||
# Machine specific settings
|
# Machine specific settings
|
||||||
clan.core.machineName = name;
|
clan.core.machineName = name;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ let
|
|||||||
inherit lib nixpkgs clan-core;
|
inherit lib nixpkgs clan-core;
|
||||||
self = ./.;
|
self = ./.;
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
#######
|
#######
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ let
|
|||||||
imports = (import (pkgs.path + "/nixos/modules/module-list.nix")) ++ [
|
imports = (import (pkgs.path + "/nixos/modules/module-list.nix")) ++ [
|
||||||
{
|
{
|
||||||
nixpkgs.hostPlatform = "x86_64-linux";
|
nixpkgs.hostPlatform = "x86_64-linux";
|
||||||
clan.core.clanName = "dummy";
|
clan.core.name = "dummy";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,33 @@
|
|||||||
{ lib, pkgs, ... }:
|
{ 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 = {
|
options.clan.core = {
|
||||||
clanName = lib.mkOption {
|
name = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = ''
|
description = ''
|
||||||
the name of the clan
|
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;
|
||||||
@@ -28,12 +50,6 @@
|
|||||||
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
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
clanIcon = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.path;
|
|
||||||
description = ''
|
|
||||||
the location of the clan icon
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
machineName = lib.mkOption {
|
machineName = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "nixos";
|
default = "nixos";
|
||||||
|
|||||||
@@ -249,8 +249,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.clanName;
|
clan_name = config.clan.core.name;
|
||||||
machine_icon = config.clan.core.machineIcon or config.clan.core.clanIcon;
|
machine_icon = config.clan.core.machineIcon or config.clan.core.icon;
|
||||||
machine_name = config.clan.core.machineName;
|
machine_name = config.clan.core.machineName;
|
||||||
machine_description = config.clan.core.machineDescription;
|
machine_description = config.clan.core.machineDescription;
|
||||||
memory_size = config.clan.virtualisation.memorySize;
|
memory_size = config.clan.virtualisation.memorySize;
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ in
|
|||||||
};
|
};
|
||||||
name = lib.mkOption {
|
name = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = config.clan.core.clanName;
|
default = config.clan.core.name;
|
||||||
defaultText = "config.clan.core.clanName";
|
defaultText = "config.clan.core.name";
|
||||||
description = ''
|
description = ''
|
||||||
zerotier network name
|
zerotier network name
|
||||||
'';
|
'';
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ def inspect_flake(flake_url: str | Path, machine_name: str) -> FlakeConfig:
|
|||||||
# Get the Clan name
|
# Get the Clan name
|
||||||
cmd = nix_eval(
|
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)
|
res = run_cmd(cmd)
|
||||||
@@ -66,7 +66,7 @@ def inspect_flake(flake_url: str | Path, machine_name: str) -> FlakeConfig:
|
|||||||
# Get the clan icon path
|
# Get the clan icon path
|
||||||
cmd = nix_eval(
|
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)
|
res = run_cmd(cmd)
|
||||||
@@ -79,9 +79,9 @@ def inspect_flake(flake_url: str | Path, machine_name: str) -> FlakeConfig:
|
|||||||
|
|
||||||
cmd = nix_build(
|
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)
|
run_cmd(cmd)
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ def verify_machine_config(
|
|||||||
) -> str | None:
|
) -> str | None:
|
||||||
"""
|
"""
|
||||||
Verify that the machine evaluates successfully
|
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:
|
if config is None:
|
||||||
config = config_for_machine(flake_dir, machine_name)
|
config = config_for_machine(flake_dir, machine_name)
|
||||||
|
|||||||
@@ -88,9 +88,9 @@ def machine_schema(
|
|||||||
[
|
[
|
||||||
clan-core.nixosModules.clanCore
|
clan-core.nixosModules.clanCore
|
||||||
# potentially the config might affect submodule options,
|
# potentially the config might affect submodule options,
|
||||||
# therefore we need to import it
|
# therefore we need to import it
|
||||||
config
|
config
|
||||||
{{ clan.core.clanName = "fakeClan"; }}
|
{{ clan.core.name = "fakeClan"; }}
|
||||||
]
|
]
|
||||||
# add all clan modules specified via clanImports
|
# add all clan modules specified via clanImports
|
||||||
++ (map (name: clan-core.clanModules.${{name}}) config.clanImports or []);
|
++ (map (name: clan-core.clanModules.${{name}}) config.clanImports or []);
|
||||||
|
|||||||
Reference in New Issue
Block a user