This should define modules that are identical, or very similar. The driving force is to be able to use `my.profiles` on home-manager and NixOS without repeating myself. In the future I might migrate other modules, such as `nixos/system/nix`...
31 lines
751 B
Nix
31 lines
751 B
Nix
# Modules that are common to various module systems
|
|
# Usually with very small differences, if any, between them.
|
|
{ lib, _class, ... }:
|
|
let
|
|
allowedClass = [
|
|
"darwin"
|
|
"home"
|
|
"nixos"
|
|
];
|
|
|
|
allowedClassString = lib.concatStringSep ", " (builtins.map lib.escapeNixString allowedClass);
|
|
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 ${allowedClassString}.
|
|
'';
|
|
}
|
|
{
|
|
assertion = type != null -> builtins.elem type allowedClass;
|
|
message = ''
|
|
`type` specialArgs must be one of ${allowedClassString}.
|
|
'';
|
|
}
|
|
];
|
|
};
|
|
}
|