lib/clan: add checks
This commit is contained in:
@@ -39,23 +39,32 @@ in
|
||||
};
|
||||
modules = [
|
||||
clan-core.modules.clan.default
|
||||
{
|
||||
checks.minNixpkgsVersion = {
|
||||
assertion = lib.versionAtLeast nixpkgs.lib.version "25.11";
|
||||
message = ''
|
||||
Nixpkgs version: ${nixpkgs.lib.version} is incompatible with clan-core. (>= 25.11 is recommended)
|
||||
---
|
||||
Your version of 'nixpkgs' seems too old for clan-core.
|
||||
Please read: https://docs.clan.lol/guides/nixpkgs-flake-input
|
||||
|
||||
You can ignore this check by setting:
|
||||
clan.checks.minNixpkgsVersion.ignore = true;
|
||||
---
|
||||
'';
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
apply =
|
||||
config:
|
||||
# TOOD:
|
||||
# - allow to disable version check?
|
||||
# - self-incrementing version?
|
||||
if !lib.versionAtLeast nixpkgs.lib.version "25.11" then
|
||||
throw ''
|
||||
Nixpkgs version: ${nixpkgs.lib.version} is incompatible with clan-core. (>= 25.11 is required)
|
||||
---
|
||||
Your version of 'nixpkgs' seems too old for clan-core.
|
||||
Please read: https://docs.clan.lol/guides/nixpkgs-flake-input
|
||||
---
|
||||
''
|
||||
else
|
||||
config;
|
||||
lib.deepSeq (lib.mapAttrs (
|
||||
id: check:
|
||||
if check.ignore || check.assertion then
|
||||
null
|
||||
else
|
||||
throw "clan.checks.${id} failed with message\n${check.message}"
|
||||
) config.checks) config;
|
||||
};
|
||||
|
||||
# Mapped flake toplevel outputs
|
||||
|
||||
Reference in New Issue
Block a user