1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

initialise fonts module

This commit is contained in:
Piotr Limanowski 2018-09-30 13:22:24 +02:00
parent b2d62a6f44
commit 7a7cbdc165
3 changed files with 42 additions and 0 deletions

View file

@ -43,6 +43,7 @@ let
./modules/nix/nix-info.nix
./modules/nix/nixpkgs.nix
./modules/environment
./modules/fonts
./modules/launchd
./modules/services/activate-system
./modules/services/buildkite-agent.nix

40
modules/fonts/default.nix Normal file
View file

@ -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" ];
};
}

View file

@ -64,6 +64,7 @@ in
${cfg.activationScripts.time.text}
${cfg.activationScripts.networking.text}
${cfg.activationScripts.keyboard.text}
${cfg.activationScripts.fonts.text}
${cfg.activationScripts.postActivation.text}