From 29839f82d7d06cce6155ed2bb8cd5c6cb1452bc1 Mon Sep 17 00:00:00 2001 From: valentin gagarin Date: Wed, 13 Nov 2024 15:24:41 +0100 Subject: [PATCH] smarter indent this allows writing the beginning of the indented string at the desired indentation --- website/lib.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/website/lib.nix b/website/lib.nix index 87a66df5..7e811476 100644 --- a/website/lib.nix +++ b/website/lib.nix @@ -36,7 +36,15 @@ rec { splitLines = s: with builtins; filter (x: !isList x) (split "\n" s); indent = prefix: s: - join "\n" (map (x: if x == "" then x else "${prefix}${x}") (splitLines s)); + with lib.lists; + let + lines = splitLines s; + in + join "\n" ( + [ (head lines) ] + ++ + (map (x: if x == "" then x else "${prefix}${x}") (tail lines)) + ); types = rec { collection = elemType: