10000 Don't look for NixOS options when module-list.nix or lib doesn't exist by figsoda · Pull Request #80 · oxalica/nil · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Don't look for NixOS options when module-list.nix or lib doesn't exist #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions crates/nix-interop/src/nixos_options.nix
8269
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
# - nixos/lib/make-options-doc/default.nix
nixpkgs:
let
lib = import (nixpkgs + "/lib");
libPath = nixpkgs + "/lib";
lib = import libPath;
modulePath = nixpkgs + "/nixos/modules";
moduleListPath = modulePath + "/module-list.nix";

inherit (builtins) isString filter mapAttrs isPath isFunction functionArgs;
inherit (builtins) isString filter mapAttrs isPath isFunction functionArgs pathExists;
inherit (lib) evalModules trivial optionals filterAttrs;
inherit (lib.options) unknownModule literalExpression;

Expand Down Expand Up @@ -34,9 +36,7 @@ let
pkgs = null;
};

modules =
(filter canCacheDocs
(import (modulePath + "/module-list.nix")));
modules = filter canCacheDocs (import moduleListPath);

# From `nixos/modules/misc/documentation.nix`.
canCacheDocs = m:
Expand Down Expand Up @@ -177,6 +177,7 @@ let
(mapAttrs (_: normalizeOptions) opts);

in
if builtins.compareVersions trivial.release "22.11" >= 0
if pathExists libPath && pathExists moduleListPath
&& builtins.compareVersions trivial.release "22.11" >= 0
then normalizeOptionSet eval.options
else { }
0