The workaround is no longer needed since Nixpkgs 22.05 (https://github.com/NixOS/nixpkgs/pull/156533). Declaring options directly in a submodule now works, e.g. `options.flake.foo`. The function is kept for backwards compatibility but documented as deprecated. The minimum supported Nixpkgs lib version is already 22.05, so this change does not drop support for any previously supported version.
26 lines
540 B
Nix
26 lines
540 B
Nix
{ self, lib, moduleLocation, ... }:
|
|
let
|
|
inherit (lib)
|
|
mapAttrs
|
|
mkOption
|
|
types
|
|
;
|
|
in
|
|
{
|
|
options = {
|
|
flake.nixosModules = mkOption {
|
|
type = types.lazyAttrsOf types.deferredModule;
|
|
default = { };
|
|
apply = mapAttrs (k: v: {
|
|
_class = "nixos";
|
|
_file = "${toString moduleLocation}#nixosModules.${k}";
|
|
imports = [ v ];
|
|
});
|
|
description = ''
|
|
NixOS modules.
|
|
|
|
You may use this for reusable pieces of configuration, service modules, etc.
|
|
'';
|
|
};
|
|
};
|
|
}
|