From c4fcbb0dcf153a8bac18d5aced9f8c025c74a66d Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Sat, 6 Jul 2024 23:06:07 +0100 Subject: [PATCH] modules/context: add `isTopLevel` option --- modules/misc/context.nix | 10 ++++++++++ modules/top-level/default.nix | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/modules/misc/context.nix b/modules/misc/context.nix index 170372ac..353d6a09 100644 --- a/modules/misc/context.nix +++ b/modules/misc/context.nix @@ -1,6 +1,16 @@ { lib, ... }: { options = { + isTopLevel = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Whether modules are being evaluated at the "top-level". + Should be false when evaluating nested submodules. + ''; + internal = true; + visible = false; + }; isDocs = lib.mkOption { type = lib.types.bool; default = false; diff --git a/modules/top-level/default.nix b/modules/top-level/default.nix index 581a1e6e..1d427020 100644 --- a/modules/top-level/default.nix +++ b/modules/top-level/default.nix @@ -10,4 +10,8 @@ ./output.nix ./test.nix ]; + + config = { + isTopLevel = true; + }; }