diff options
| author | Piotr Limanowski <piotr@codearsonist.com> | 2018-10-05 22:16:00 +0200 |
|---|---|---|
| committer | Piotr Limanowski <piotr@codearsonist.com> | 2018-10-05 22:27:29 +0200 |
| commit | 2a53ac278f42f51f6d72d9a5de41322b977ac260 (patch) | |
| tree | d38ca0862ab3f0af57587005b179441e4ff429d5 /modules/fonts | |
| parent | da886d015c3ed9047878d3618a73ca6eafae51f5 (diff) | |
fonts: adds `enableFontDir` flag
For NixOS compatibility reasons we're using enableFontDir flag that
in turn enables/disables font management in /Library/Fonts directory.
Diffstat (limited to 'modules/fonts')
| -rw-r--r-- | modules/fonts/default.nix | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/modules/fonts/default.nix b/modules/fonts/default.nix index 4c0d4e8..5c80b30 100644 --- a/modules/fonts/default.nix +++ b/modules/fonts/default.nix @@ -21,22 +21,29 @@ let in { options = { fonts = { + enableFontDir = mkOption { + default = false; + description = '' + Whether to enable font directory management. + Important: enabling font directory management removes all manually-added fonts. + ''; + }; fonts = mkOption { type = types.listOf types.path; default = []; example = literalExample "[ pkgs.dejavu_fonts ]"; - description = "List of primary font paths. Important: Manually added fonts will be removed upon rebuild."; + description = "List of primary font paths."; }; }; }; config = { - system.build.fonts = pkgs.buildEnv { + system.build.fonts = mkIf cfg.enableFontDir (pkgs.buildEnv { name = "system-fonts"; paths = cfg.fonts; pathsToLink = "/share/fonts"; - }; - system.activationScripts.fonts.text = '' + }); + system.activationScripts.fonts.text = "" + optionalString cfg.enableFontDir '' # Set up fonts. echo "resetting fonts..." >&2 fontrestore default -n 2>&1 | grep -o '/Library/Fonts/.*' | tr '\n' '\0' | xargs -0 rm || true |
