darwin: fonts: speed up font installation
* Skip font installation if the derivation hasn't changed. * Use `rsync` instead of `install` to copy font files, to avoid useless copying of pre-existent identical files.
This commit is contained in:
parent
11edf9cad7
commit
738527f866
|
@ -10,20 +10,17 @@ let
|
||||||
pathsToLink = "/share/fonts";
|
pathsToLink = "/share/fonts";
|
||||||
};
|
};
|
||||||
fonts = "${fontsEnv}/share/fonts";
|
fonts = "${fontsEnv}/share/fonts";
|
||||||
|
installDir = "${homeDir}/Library/Fonts/HomeManager";
|
||||||
in {
|
in {
|
||||||
# macOS won't recognize symlinked fonts
|
# macOS won't recognize symlinked fonts
|
||||||
config = mkIf pkgs.stdenv.hostPlatform.isDarwin {
|
config = mkIf pkgs.stdenv.hostPlatform.isDarwin {
|
||||||
home.activation.copyFonts = hm.dag.entryAfter [ "writeBoundary" ] ''
|
home.file."Library/Fonts/.home-manager-fonts-version" = {
|
||||||
copyFonts() {
|
text = "${fontsEnv}";
|
||||||
rm -rf ${homeDir}/Library/Fonts/HomeManager || :
|
onChange = ''
|
||||||
|
run mkdir -p ${escapeShellArg installDir}
|
||||||
local f
|
run ${pkgs.rsync}/bin/rsync $VERBOSE_ARG -acL --chmod=u+w --delete \
|
||||||
find -L "${fonts}" -type f -printf '%P\0' | while IFS= read -rd "" f; do
|
${escapeShellArgs [ "${fonts}/" installDir ]}
|
||||||
run install $VERBOSE_ARG -Dm644 -T \
|
|
||||||
"${fonts}/$f" "${homeDir}/Library/Fonts/HomeManager/$f"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
copyFonts
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue