summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2015-04-18 19:04:03 +0100
committerMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2015-04-18 19:04:03 +0100
commit1713184b11bf626ba8cce7df5efa159a71907ee6 (patch)
treebf8a48bde231a70f06af28dc272b36b679cbbbd5 /nixos
parentd7810b4303dad00a4503e64e46168be8c7841df0 (diff)
downloadnixlib-1713184b11bf626ba8cce7df5efa159a71907ee6.tar
nixlib-1713184b11bf626ba8cce7df5efa159a71907ee6.tar.gz
nixlib-1713184b11bf626ba8cce7df5efa159a71907ee6.tar.bz2
nixlib-1713184b11bf626ba8cce7df5efa159a71907ee6.tar.lz
nixlib-1713184b11bf626ba8cce7df5efa159a71907ee6.tar.xz
nixlib-1713184b11bf626ba8cce7df5efa159a71907ee6.tar.zst
nixlib-1713184b11bf626ba8cce7df5efa159a71907ee6.zip
xserver.nix: fix indentation issues under Device
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/x11/xserver.nix14
1 files changed, 11 insertions, 3 deletions
diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix
index 69632b84262a..5198864ef6ef 100644
--- a/nixos/modules/services/x11/xserver.nix
+++ b/nixos/modules/services/x11/xserver.nix
@@ -41,9 +41,17 @@ let
     };
   in imap mkHead cfg.xrandrHeads;
 
-  xrandrDeviceSection = flip concatMapStrings xrandrHeads (h: ''
-    Option "monitor-${h.output}" "${h.name}"
-  '');
+  xrandrDeviceSection = let
+    monitors = flip map xrandrHeads (h: ''
+      Option "monitor-${h.output}" "${h.name}"
+    '');
+    # First option is indented through the space in the config but any
+    # subsequent options aren't so we need to apply indentation to
+    # them here
+    monitorsIndented = if length monitors > 1
+      then singleton (head monitors) ++ map (m: "  " + m) (tail monitors)
+      else monitors;
+  in concatStrings monitorsIndented;
 
   # Here we chain every monitor from the left to right, so we have:
   # m4 right of m3 right of m2 right of m1   .----.----.----.----.