Merge pull request 'feat(clanModules): add deprecation feature that generates a warning if the module is used' (#3648) from hsjobeki/clan-core:persistence-1 into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3648
This commit is contained in:
hsjobeki
2025-05-14 15:13:51 +00:00
3 changed files with 13 additions and 9 deletions

View File

@@ -18,14 +18,6 @@
../../root-password
];
config = {
warnings = [
''
The admin module has been migrated from `clan.services` to `clan.instances`
See https://docs.clan.lol/manual/distributed-services for usage.
''
];
users.users.root.openssh.authorizedKeys.keys = builtins.attrValues config.clan.admin.allowedKeys;
};
}

View File

@@ -1,6 +1,6 @@
---
description = "Configures Wifi networks to join"
features = [ "inventory", "experimental" ]
features = [ "inventory", "experimental", "deprecated" ]
categories = [ "Network", "System" ]
---

View File

@@ -107,12 +107,24 @@ let
extraModules = map (s: if builtins.typeOf s == "string" then "${directory}/${s}" else s) (
globalExtraModules ++ machineExtraModules ++ roleServiceExtraModules
);
features =
(clanLib.modules.getFrontmatter inventory.modules.${serviceName} serviceName).features or [ ];
deprecationWarning = lib.optionalAttrs (builtins.elem "deprecated" features) {
warnings = [
''
The '${serviceName}' module has been migrated from `inventory.services` to `inventory.instances`
See https://docs.clan.lol/manual/distributed-services/ for usage.
''
];
};
in
if !(serviceConfig.enabled or true) then
acc2
else if isInService then
acc2
++ [
deprecationWarning
{
imports = roleModules ++ extraModules;
clan.inventory.services.${serviceName}.${instanceName} = {