diff options
| author | Piotr Limanowski <piotr@codearsonist.com> | 2018-09-30 13:22:24 +0200 |
|---|---|---|
| committer | Piotr Limanowski <piotr@codearsonist.com> | 2018-09-30 13:22:24 +0200 |
| commit | 7a7cbdc1652a9a06c4fb52a00c6e688845964984 (patch) | |
| tree | 3abdecdfee8662e45760c15be9b0cc74bbe1a96d /modules/fonts/default.nix | |
| parent | b2d62a6f4441ddcedf707dde41984245409ba652 (diff) | |
initialise fonts module
Diffstat (limited to 'modules/fonts/default.nix')
| -rw-r--r-- | modules/fonts/default.nix | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/modules/fonts/default.nix b/modules/fonts/default.nix new file mode 100644 index 0000000..bacec1a --- /dev/null +++ b/modules/fonts/default.nix @@ -0,0 +1,40 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.fonts; +in { + options = { + fonts = { + enableFontDir = mkOption { + default = false; + description = '' + Whether to create a directory with links to all fonts in + <filename>/run/current-system/sw/share/fonts</filename>. + ''; + }; + fonts = mkOption { + type = types.listOf types.path; + default = []; + example = literalExample "[ pkgs.dejavu_fonts ]"; + description = "List of primary font paths."; + }; + }; + }; + + config = mkIf cfg.enableFontDir { + system.build.fonts = pkgs.buildEnv { + name = "system-fonts"; + paths = cfg.fonts; + pathsToLink = "/share/fonts/truetype"; + }; + system.activationScripts.fonts.text = '' + # Set up fonts. + echo "setting up fonts..." >&2 + /bin/ln -hf ${config.system.build.fonts}/share/fonts/truetype/* /Library/Fonts/ + ''; + environment.pathsToLink = [ "/share/fonts/truetype" ]; + }; + +} |
