1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

fonts: refactor system.build.fonts

Process substitution behaves better with variables and it's good
practice to use `lib.escapeShellArgs`.
This commit is contained in:
Emily 2023-08-03 02:11:40 +01:00
parent 09e72ff9b9
commit 27517d2d18

View file

@ -41,9 +41,14 @@ in
'' ''
mkdir -p $out/Library/Fonts mkdir -p $out/Library/Fonts
font_regexp='.*\.\(ttf\|ttc\|otf\|dfont\)' font_regexp='.*\.\(ttf\|ttc\|otf\|dfont\)'
find -L ${toString cfg.fonts} -regex "$font_regexp" -type f -print0 | while IFS= read -rd "" f; do while IFS= read -rd "" f; do
ln -sf "$f" $out/Library/Fonts ln -sf "$f" "$out/Library/Fonts"
done done < <(
find -L ${lib.escapeShellArgs cfg.fonts} \
-type f \
-regex "$font_regexp" \
-print0
)
''; '';
system.activationScripts.fonts.text = lib.optionalString cfg.fontDir.enable '' system.activationScripts.fonts.text = lib.optionalString cfg.fontDir.enable ''