mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 11:39:46 +01:00
targets/darwin: copy fonts to ~/Library/Fonts/HomeManager (#1817)
Fonts are copied instead of being symlinked because macOS won't recognize symlinked fonts.
This commit is contained in:
parent
da92360208
commit
2b7a73071a
2 changed files with 28 additions and 1 deletions
|
@ -19,7 +19,7 @@ let
|
||||||
writableDefaults = filterAttrs (domain: attrs: attrs != { }) nonNullDefaults;
|
writableDefaults = filterAttrs (domain: attrs: attrs != { }) nonNullDefaults;
|
||||||
activationCmds = mapAttrsToList toActivationCmd writableDefaults;
|
activationCmds = mapAttrsToList toActivationCmd writableDefaults;
|
||||||
in {
|
in {
|
||||||
imports = [ ./keybindings.nix ./linkapps.nix ./search.nix ];
|
imports = [ ./fonts.nix ./keybindings.nix ./linkapps.nix ./search.nix ];
|
||||||
|
|
||||||
options.targets.darwin.defaults = mkOption {
|
options.targets.darwin.defaults = mkOption {
|
||||||
type = types.submodule ./options.nix;
|
type = types.submodule ./options.nix;
|
||||||
|
|
27
modules/targets/darwin/fonts.nix
Normal file
27
modules/targets/darwin/fonts.nix
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{ 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
|
||||||
|
config.home.activation.copyFonts = hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||||
|
copyFonts() {
|
||||||
|
rm -rf ${homeDir}/Library/Fonts/HomeManager || :
|
||||||
|
|
||||||
|
local f
|
||||||
|
find -L "${fonts}" -type f -printf '%P\0' | while IFS= read -rd "" f; do
|
||||||
|
$DRY_RUN_CMD install $VERBOSE_ARG -Dm644 -T \
|
||||||
|
"${fonts}/$f" "${homeDir}/Library/Fonts/HomeManager/$f"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
copyFonts
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue