mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-02 21:10:08 +00:00
`lib/services/service.nix` reached outside of `lib/` for two class-agnostic module fragments: `modules/generic/meta-maintainers.nix` and `nixos/modules/misc/assertions.nix`. That prevents `lib/` from being used as a standalone tree, which is exactly how `nixos/modules/misc/documentation.nix` consumes it when building `lazy-options.json`. Host both fragments in `lib/` and expose them as `lib.genericModules`, so that consumers outside `lib/` reach them through the `lib` module argument instead of a filesystem-relative import. The old locations become re-exports, keeping `modules/generic/meta-maintainers.nix` importable as documented in `modules/README.md` and `nixos/modules/misc/assertions.nix` usable from `nixos/modules/module-list.nix`. `lib` now shares the `filteredModules` tree in `documentation.nix`, so that `declarations` pointing into it are stripped like the ones pointing into `modules` and `nixos`, rather than leaving a disallowed store path reference in `lazy-options.json`. Assisted-by: Claude:claude-opus-5
40 lines
1.0 KiB
Nix
40 lines
1.0 KiB
Nix
{ lib, ... }:
|
|
{
|
|
_class = null; # not specific to NixOS
|
|
|
|
options = {
|
|
|
|
assertions = lib.mkOption {
|
|
type = lib.types.listOf lib.types.unspecified;
|
|
internal = true;
|
|
default = [ ];
|
|
example = [
|
|
{
|
|
assertion = false;
|
|
message = "you can't enable this for that reason";
|
|
}
|
|
];
|
|
description = ''
|
|
This option allows modules to express conditions that must
|
|
hold for the evaluation of the system configuration to
|
|
succeed, along with associated error messages for the user.
|
|
'';
|
|
};
|
|
|
|
warnings = lib.mkOption {
|
|
internal = true;
|
|
default = [ ];
|
|
type = lib.types.listOf lib.types.str;
|
|
example = [ "The `foo' service is deprecated and will go away soon!" ];
|
|
description = ''
|
|
This option allows modules to show warnings to users during
|
|
the evaluation of the system configuration.
|
|
'';
|
|
};
|
|
|
|
};
|
|
# impl of assertions is in
|
|
# - <nixpkgs/nixos/modules/system/activation/top-level.nix>
|
|
# - <nixpkgs/lib/services/lib.nix>
|
|
}
|