feat(clanModules): add deprecation feature that generates a warning if the module is used
This commit is contained in:
@@ -18,14 +18,6 @@
|
|||||||
../../root-password
|
../../root-password
|
||||||
];
|
];
|
||||||
config = {
|
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;
|
users.users.root.openssh.authorizedKeys.keys = builtins.attrValues config.clan.admin.allowedKeys;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,12 +107,24 @@ let
|
|||||||
extraModules = map (s: if builtins.typeOf s == "string" then "${directory}/${s}" else s) (
|
extraModules = map (s: if builtins.typeOf s == "string" then "${directory}/${s}" else s) (
|
||||||
globalExtraModules ++ machineExtraModules ++ roleServiceExtraModules
|
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
|
in
|
||||||
if !(serviceConfig.enabled or true) then
|
if !(serviceConfig.enabled or true) then
|
||||||
acc2
|
acc2
|
||||||
else if isInService then
|
else if isInService then
|
||||||
acc2
|
acc2
|
||||||
++ [
|
++ [
|
||||||
|
deprecationWarning
|
||||||
{
|
{
|
||||||
imports = roleModules ++ extraModules;
|
imports = roleModules ++ extraModules;
|
||||||
clan.inventory.services.${serviceName}.${instanceName} = {
|
clan.inventory.services.${serviceName}.${instanceName} = {
|
||||||
|
|||||||
Reference in New Issue
Block a user