depot/third_party/home-manager/modules/targets/darwin/fonts.nix
Default email 4d19ca4703 Project import generated by Copybara.
GitOrigin-RevId: a7117efb3725e6197dd95424136f79147aa35e5b
2024-06-04 11:23:39 -07:00

26 lines
726 B
Nix

{ 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";
installDir = "${homeDir}/Library/Fonts/HomeManager";
in {
# macOS won't recognize symlinked fonts
config = mkIf pkgs.stdenv.hostPlatform.isDarwin {
home.file."Library/Fonts/.home-manager-fonts-version" = {
text = "${fontsEnv}";
onChange = ''
run mkdir -p ${escapeShellArg installDir}
run ${pkgs.rsync}/bin/rsync $VERBOSE_ARG -acL --chmod=u+w --delete \
${escapeShellArgs [ "${fonts}/" installDir ]}
'';
};
};
}