2024-01-03 17:49:19 +01:00
|
|
|
# Modules that are common to various module systems
|
|
|
|
# Usually with very small differences, if any, between them.
|
|
|
|
{ lib, type ? null, ... }:
|
|
|
|
let
|
|
|
|
allowedTypes = [
|
|
|
|
"darwin"
|
2024-01-03 17:50:05 +01:00
|
|
|
"home"
|
|
|
|
"nixos"
|
2024-01-03 17:49:19 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
allowedTypesString = lib.concatStringSep ", " (builtins.map lib.escapeNixString allowedTypes);
|
|
|
|
in
|
|
|
|
{
|
|
|
|
config = {
|
|
|
|
assertions = [
|
|
|
|
{
|
|
|
|
assertion = type != null;
|
|
|
|
message = ''
|
|
|
|
You must provide `type` as part of specialArgs to use the common modules.
|
|
|
|
It must be one of ${allowedTypesString}.
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
{
|
|
|
|
assertion = type != null -> builtins.elem type allowedTypes;
|
|
|
|
message = ''
|
|
|
|
`type` specialArgs must be one of ${allowedTypesString}.
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|