mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-15 21:08:21 +00:00
initialise fonts module
This commit is contained in:
parent
b2d62a6f44
commit
7a7cbdc165
3 changed files with 42 additions and 0 deletions
|
@ -43,6 +43,7 @@ let
|
||||||
./modules/nix/nix-info.nix
|
./modules/nix/nix-info.nix
|
||||||
./modules/nix/nixpkgs.nix
|
./modules/nix/nixpkgs.nix
|
||||||
./modules/environment
|
./modules/environment
|
||||||
|
./modules/fonts
|
||||||
./modules/launchd
|
./modules/launchd
|
||||||
./modules/services/activate-system
|
./modules/services/activate-system
|
||||||
./modules/services/buildkite-agent.nix
|
./modules/services/buildkite-agent.nix
|
||||||
|
|
40
modules/fonts/default.nix
Normal file
40
modules/fonts/default.nix
Normal 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" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -64,6 +64,7 @@ in
|
||||||
${cfg.activationScripts.time.text}
|
${cfg.activationScripts.time.text}
|
||||||
${cfg.activationScripts.networking.text}
|
${cfg.activationScripts.networking.text}
|
||||||
${cfg.activationScripts.keyboard.text}
|
${cfg.activationScripts.keyboard.text}
|
||||||
|
${cfg.activationScripts.fonts.text}
|
||||||
|
|
||||||
${cfg.activationScripts.postActivation.text}
|
${cfg.activationScripts.postActivation.text}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue