about summary refs log tree commit diff
path: root/lib/types.nix
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2022-10-07 09:58:55 +0200
committerMaximilian Bosch <maximilian@mbosch.me>2022-10-07 10:01:44 +0200
commitac48f07282b1e71614f198a241e8f08b252ed509 (patch)
treee067ff3b0388c84d7330b27851ea67b9414b33f5 /lib/types.nix
parent352ed567a786e4c0f9c7a0838783fd9a84e85c5a (diff)
downloadnixlib-ac48f07282b1e71614f198a241e8f08b252ed509.tar
nixlib-ac48f07282b1e71614f198a241e8f08b252ed509.tar.gz
nixlib-ac48f07282b1e71614f198a241e8f08b252ed509.tar.bz2
nixlib-ac48f07282b1e71614f198a241e8f08b252ed509.tar.lz
nixlib-ac48f07282b1e71614f198a241e8f08b252ed509.tar.xz
nixlib-ac48f07282b1e71614f198a241e8f08b252ed509.tar.zst
nixlib-ac48f07282b1e71614f198a241e8f08b252ed509.zip
lib/types: always use `<function body>` instead of `[function body]` to indicate a function inside an option structure
The motivation is to have a single identifier for that. Useful for the
next commit where I'll try to escape option-parts correctly (options can
be any kind of strings, but unless these are Nix identifiers, they must
be quoted).

Since `<function body>` (or `<name>`/`*`) are special identifiers in
error messages and the manual, we need a unique way to mark an option
part as function call because these are not to be quoted.
Diffstat (limited to 'lib/types.nix')
-rw-r--r--lib/types.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/types.nix b/lib/types.nix
index 9b2c5e846ad1..db5ae03d6fe9 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -616,8 +616,8 @@ rec {
       descriptionClass = "composite";
       check = isFunction;
       merge = loc: defs:
-        fnArgs: (mergeDefinitions (loc ++ [ "[function body]" ]) elemType (map (fn: { inherit (fn) file; value = fn.value fnArgs; }) defs)).mergedValue;
-      getSubOptions = prefix: elemType.getSubOptions (prefix ++ [ "[function body]" ]);
+        fnArgs: (mergeDefinitions (loc ++ [ "<function body>" ]) elemType (map (fn: { inherit (fn) file; value = fn.value fnArgs; }) defs)).mergedValue;
+      getSubOptions = prefix: elemType.getSubOptions (prefix ++ [ "<function body>" ]);
       getSubModules = elemType.getSubModules;
       substSubModules = m: functionTo (elemType.substSubModules m);
       functor = (defaultFunctor "functionTo") // { wrapped = elemType; };