summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2017-07-03 07:33:35 +0200
committeraszlig <aszlig@redmoonstudios.org>2017-07-03 08:29:16 +0200
commitd97cdfc591baf790ce5a9836e1503dfb0eb152e6 (patch)
treeecf8da49e344a2ba97a819ed79e09c495e61e6c8 /nixos/modules/services
parent02ce6963045ed2a1ed41538419a3954ead23fa51 (diff)
downloadnixlib-d97cdfc591baf790ce5a9836e1503dfb0eb152e6.tar
nixlib-d97cdfc591baf790ce5a9836e1503dfb0eb152e6.tar.gz
nixlib-d97cdfc591baf790ce5a9836e1503dfb0eb152e6.tar.bz2
nixlib-d97cdfc591baf790ce5a9836e1503dfb0eb152e6.tar.lz
nixlib-d97cdfc591baf790ce5a9836e1503dfb0eb152e6.tar.xz
nixlib-d97cdfc591baf790ce5a9836e1503dfb0eb152e6.tar.zst
nixlib-d97cdfc591baf790ce5a9836e1503dfb0eb152e6.zip
nixos/xserver: Document the layouts sed expression
This was brought up by @0xABAB in #26984 by the following comment:

https://github.com/NixOS/nixpkgs/pull/26984#discussion_r125146405

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/x11/xserver.nix4
1 files changed, 4 insertions, 0 deletions
diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix
index 01bab8fccadb..504a6b79d577 100644
--- a/nixos/modules/services/x11/xserver.nix
+++ b/nixos/modules/services/x11/xserver.nix
@@ -652,6 +652,10 @@ in
       inherit (cfg) layout xkbDir;
     } ''
       if sed -n -e ':i /^! \(layout\|variant\) *$/ {
+          # Loop through all of the layouts/variants until we hit another ! at
+          # the start of the line or the line is empty ('t' branches only if
+          # the last substitution was successful, so if the line is empty the
+          # substition will fail).
           :l; n; /^!/bi; s/^ *\([^ ]\+\).*/\1/p; tl
          }' "$xkbDir/rules/base.lst" | grep -qxF "$layout"
       then