mirror of
https://github.com/oxalica/nil.git
synced 2024-11-22 11:22:46 +03:00
Evaluate NixOS options for 22.11
This commit is contained in:
parent
715b0a5244
commit
2c65120ddf
@ -6,9 +6,23 @@ let
|
||||
lib = import (nixpkgs + "/lib");
|
||||
modulePath = nixpkgs + "/nixos/modules";
|
||||
|
||||
inherit (builtins) filter mapAttrs isPath isFunction functionArgs;
|
||||
inherit (builtins) isString filter mapAttrs isPath isFunction functionArgs;
|
||||
inherit (lib) evalModules trivial optionals filterAttrs;
|
||||
inherit (lib.options) unknownModule renderOptionValue;
|
||||
inherit (lib.options) unknownModule literalExpression;
|
||||
|
||||
# Polyfill for < 23.05
|
||||
renderOptionValue = lib.options.renderOptionValue or (v:
|
||||
if v ? _type && v ? text then v
|
||||
else literalExpression (lib.generators.toPretty {
|
||||
multiline = true;
|
||||
allowPrettyValues = true;
|
||||
} v));
|
||||
|
||||
# Special tranfrom for < 23.05
|
||||
renderDoc = v:
|
||||
if isString v
|
||||
then { _type = "mkDoc"; text = v; }
|
||||
else v;
|
||||
|
||||
# Dummy `pkgs`.
|
||||
pkgs = import (nixpkgs + "/pkgs/pkgs-lib") {
|
||||
@ -127,7 +141,7 @@ let
|
||||
submoduleVisible = visible && (opt.visible or true == true);
|
||||
|
||||
opt' = {
|
||||
description = opt.description or null;
|
||||
description = renderDoc (opt.description or null);
|
||||
declarations = filter (x: x != unknownModule) opt.declarations;
|
||||
readOnly = opt.readOnly or false;
|
||||
type = normalizeType submoduleVisible opt.type;
|
||||
@ -163,6 +177,6 @@ let
|
||||
(mapAttrs (_: normalizeOptions) opts);
|
||||
|
||||
in
|
||||
if builtins.compareVersions trivial.release "23.05" >= 0
|
||||
if builtins.compareVersions trivial.release "22.11" >= 0
|
||||
then normalizeOptionSet eval.options
|
||||
else { }
|
||||
|
Loading…
Reference in New Issue
Block a user