summary refs log tree commit diff
path: root/lib/modules.nix
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2023-02-13 11:09:35 +0100
committerRobert Hensing <robert@roberthensing.nl>2023-05-06 18:29:03 +0200
commit3633bf98be70af326056ebc87a9adedd0e8a24c7 (patch)
treec49890b758d1800e9130c895f0ae8871d95d94bd /lib/modules.nix
parentfe1527939038ac964df2028e6b90c35121db9955 (diff)
downloadnixpkgs-3633bf98be70af326056ebc87a9adedd0e8a24c7.tar
nixpkgs-3633bf98be70af326056ebc87a9adedd0e8a24c7.tar.gz
nixpkgs-3633bf98be70af326056ebc87a9adedd0e8a24c7.tar.bz2
nixpkgs-3633bf98be70af326056ebc87a9adedd0e8a24c7.tar.lz
nixpkgs-3633bf98be70af326056ebc87a9adedd0e8a24c7.tar.xz
nixpkgs-3633bf98be70af326056ebc87a9adedd0e8a24c7.tar.zst
nixpkgs-3633bf98be70af326056ebc87a9adedd0e8a24c7.zip
lib/modules.nix: Make some functions private
The supposedly public nature of these functions has been holding
back module system maintenance, while usages of these functions
are expected to be rare. If used anywhere, presumably they're
emulating module system behavior because some use case isn't supported
properly. We should try to support such a use case directly, if it
even exists.
Diffstat (limited to 'lib/modules.nix')
-rw-r--r--lib/modules.nix33
1 files changed, 22 insertions, 11 deletions
diff --git a/lib/modules.nix b/lib/modules.nix
index de03b50e269..0a842aa0063 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -1215,28 +1215,41 @@ let
     config = lib.importTOML file;
   };
 
+  private = lib.mapAttrs
+    (k: lib.warn "External use of `lib.modules.${k}` is deprecated. If your use case isn't covered by non-deprecated functions, we'd like to know more and perhaps support your use case well, instead of providing access to these low level functions. In this case please open an issue in https://github.com/nixos/nixpkgs/issues/.")
+    {
+      inherit
+        applyModuleArgsIfFunction
+        collectModules
+        dischargeProperties
+        evalOptionValue
+        mergeModules
+        mergeModules'
+        pushDownProperties
+        unifyModuleSyntax
+        ;
+    };
+
 in
+private //
 {
+  # NOTE: not all of these functions are necessarily public interfaces; some
+  #       are just needed by types.nix, but are not meant to be consumed
+  #       externally.
   inherit
-    applyModuleArgsIfFunction
-    collectModules
     defaultOrderPriority
     defaultOverridePriority
     defaultPriority
-    dischargeProperties
     doRename
     evalModules
-    evalOptionValue
     filterOverrides
     filterOverrides'
     fixMergeModules
-    fixupOptionType
+    fixupOptionType  # should be private?
     importJSON
     importTOML
     mergeDefinitions
-    mergeModules
-    mergeModules'
-    mergeOptionDecls
+    mergeOptionDecls  # should be private?
     mkAfter
     mkAliasAndWrapDefinitions
     mkAliasAndWrapDefsWithPriority
@@ -1262,8 +1275,6 @@ in
     mkRenamedOptionModule
     mkRenamedOptionModuleWith
     mkVMOverride
-    pushDownProperties
     setDefaultModuleLocation
-    sortProperties
-    unifyModuleSyntax;
+    sortProperties;
 }