2021-02-21 06:34:56 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
homeDir = config.home.homeDirectory;
|
|
|
|
fontsEnv = pkgs.buildEnv {
|
|
|
|
name = "home-manager-fonts";
|
|
|
|
paths = config.home.packages;
|
|
|
|
pathsToLink = "/share/fonts";
|
|
|
|
};
|
|
|
|
fonts = "${fontsEnv}/share/fonts";
|
|
|
|
in {
|
|
|
|
# macOS won't recognize symlinked fonts
|
2021-12-03 06:30:34 +01:00
|
|
|
config = mkIf pkgs.stdenv.hostPlatform.isDarwin {
|
2021-07-07 23:24:27 +02:00
|
|
|
home.activation.copyFonts = hm.dag.entryAfter [ "writeBoundary" ] ''
|
|
|
|
copyFonts() {
|
|
|
|
rm -rf ${homeDir}/Library/Fonts/HomeManager || :
|
2021-02-21 06:34:56 +01:00
|
|
|
|
2021-07-07 23:24:27 +02:00
|
|
|
local f
|
|
|
|
find -L "${fonts}" -type f -printf '%P\0' | while IFS= read -rd "" f; do
|
2024-01-13 23:15:00 +01:00
|
|
|
run install $VERBOSE_ARG -Dm644 -T \
|
2021-07-07 23:24:27 +02:00
|
|
|
"${fonts}/$f" "${homeDir}/Library/Fonts/HomeManager/$f"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
copyFonts
|
|
|
|
'';
|
|
|
|
};
|
2021-02-21 06:34:56 +01:00
|
|
|
}
|