Skip to content

Commit

Permalink
fonts: refactor system.build.fonts
Browse files Browse the repository at this point in the history
Process substitution behaves better with variables and it's good
practice to use `lib.escapeShellArgs`.
  • Loading branch information
emilazy authored and kamushadenes committed Jul 8, 2024
1 parent e8dcea5 commit 1301cfc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions modules/fonts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''
Expand Down

0 comments on commit 1301cfc

Please sign in to comment.