From 1713184b11bf626ba8cce7df5efa159a71907ee6 Mon Sep 17 00:00:00 2001 From: Mateusz Kowalczyk Date: Sat, 18 Apr 2015 19:04:03 +0100 Subject: xserver.nix: fix indentation issues under Device --- nixos/modules/services/x11/xserver.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'nixos') 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 .----.----.----.----. -- cgit 1.4.1