about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/options.nix15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/options.nix b/lib/options.nix
index 7407905131b50..d5006365e54c5 100644
--- a/lib/options.nix
+++ b/lib/options.nix
@@ -200,13 +200,14 @@ rec {
      Unlike attributes, options can also start with numbers:
        (showOption ["windowManager" "2bwm" "enable"]) == "windowManager.2bwm.enable"
   */
-  showOption = parts:
-    let
-      escapeOptionPart = part:
-        if part == "*" || builtins.match "<.+>" part != null || builtins.match "[a-zA-Z0-9_][a-zA-Z0-9_'-]+" part != null
-        then part
-        else escapeNixIdentifier part;
-    in concatMapStringsSep "." escapeOptionPart parts;
+  showOption = parts: let
+    escapeOptionPart = part:
+      let
+        escaped = lib.strings.escapeNixString part;
+      in if escaped == "\"${part}\""
+         then part
+         else escaped;
+    in (concatStringsSep ".") (map escapeOptionPart parts);
   showFiles = files: concatStringsSep " and " (map (f: "`${f}'") files);
   unknownModule = "<unknown-file>";