1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00
home-manager/modules/targets/darwin/fonts.nix
Austin Horstman cba2f9ce95 treewide: reformat nixfmt-rfc-style
Reformat repository using new nixfmt-rfc-style.
2025-04-08 08:50:05 -07:00

33 lines
769 B
Nix

{
config,
lib,
pkgs,
...
}:
let
homeDir = config.home.homeDirectory;
fontsEnv = pkgs.buildEnv {
name = "home-manager-fonts";
paths = config.home.packages;
pathsToLink = "/share/fonts";
};
fonts = "${fontsEnv}/share/fonts";
installDir = "${homeDir}/Library/Fonts/HomeManager";
in
{
# macOS won't recognize symlinked fonts
config = lib.mkIf pkgs.stdenv.hostPlatform.isDarwin {
home.file."Library/Fonts/.home-manager-fonts-version" = {
text = "${fontsEnv}";
onChange = ''
run mkdir -p ${lib.escapeShellArg installDir}
run ${pkgs.rsync}/bin/rsync $VERBOSE_ARG -acL --chmod=u+w --delete \
${lib.escapeShellArgs [
"${fonts}/"
installDir
]}
'';
};
};
}