Skip to content

Commit

Permalink
nixos/dovecot: Make quoted-strings regexp compatible with macOS (cf: N…
Browse files Browse the repository at this point in the history
…ixOS/nix#1537)

Also avoid trimming single-line string values unnecessarily.
  • Loading branch information
ntninja authored and 2xsaiko committed Dec 2, 2024
1 parent 3964bba commit c0e9cca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nixos/modules/services/mail/dovecot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let
# Find index of last non-empty line in line list
lastContentIndex = length lines - (findFirstIndex (
line: match "[[:space:]]*" line == null # <=> Line is not empty
) (length lines) (reverseList lines));
) (length lines - 1) (reverseList lines));
# Drop empty trailing lines from line list
trimmedLines = sublist 0 lastContentIndex lines;
in
Expand All @@ -47,7 +47,7 @@ let
escapeDovecotString = string:
let
escapedString = escape ["\\" "\""] string;
in if match ''[[:space:]]*<.*|.*[[:space:]#"\].*|'' string != null
in if match ''[[:space:]]*<.*|.*[[:space:]#"\\].*|^$'' string != null
then "\"${formatDovecotMultiline escapedString}\""
else string;

Expand Down

0 comments on commit c0e9cca

Please sign in to comment.