From 27517d2d182629cf32020b9c77cffdc462a34c01 Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 3 Aug 2023 02:11:40 +0100 Subject: [PATCH] fonts: refactor `system.build.fonts` Process substitution behaves better with variables and it's good practice to use `lib.escapeShellArgs`. --- modules/fonts/default.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/fonts/default.nix b/modules/fonts/default.nix index cde6148b5..8bf5f725b 100644 --- a/modules/fonts/default.nix +++ b/modules/fonts/default.nix @@ -41,9 +41,14 @@ in '' mkdir -p $out/Library/Fonts font_regexp='.*\.\(ttf\|ttc\|otf\|dfont\)' - find -L ${toString cfg.fonts} -regex "$font_regexp" -type f -print0 | while IFS= read -rd "" f; do - ln -sf "$f" $out/Library/Fonts - done + while IFS= read -rd "" f; do + ln -sf "$f" "$out/Library/Fonts" + done < <( + find -L ${lib.escapeShellArgs cfg.fonts} \ + -type f \ + -regex "$font_regexp" \ + -print0 + ) ''; system.activationScripts.fonts.text = lib.optionalString cfg.fontDir.enable ''