summary refs log tree commit diff
path: root/nixos/modules/config/fonts/fontconfig-penultimate.nix
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@secure.mailbox.org>2017-03-20 11:43:50 -0500
committerGitHub <noreply@github.com>2017-03-20 11:43:50 -0500
commit1b0d9e9ae64b677c09f345f740f5a94fa41eb468 (patch)
tree1cbb71acfb427c9521ea4552853692898ee755c4 /nixos/modules/config/fonts/fontconfig-penultimate.nix
parent48bc3cf9f497f38d0bfcf0ac6a808a1cd411a855 (diff)
parentd458b5401a36dd87cfd2bd071f634330f095cf5d (diff)
downloadnixlib-1b0d9e9ae64b677c09f345f740f5a94fa41eb468.tar
nixlib-1b0d9e9ae64b677c09f345f740f5a94fa41eb468.tar.gz
nixlib-1b0d9e9ae64b677c09f345f740f5a94fa41eb468.tar.bz2
nixlib-1b0d9e9ae64b677c09f345f740f5a94fa41eb468.tar.lz
nixlib-1b0d9e9ae64b677c09f345f740f5a94fa41eb468.tar.xz
nixlib-1b0d9e9ae64b677c09f345f740f5a94fa41eb468.tar.zst
nixlib-1b0d9e9ae64b677c09f345f740f5a94fa41eb468.zip
Merge pull request #23819 from ttuegel/freetype
FreeType 2.7.1 and Fontconfig defaults
Diffstat (limited to 'nixos/modules/config/fonts/fontconfig-penultimate.nix')
-rw-r--r--nixos/modules/config/fonts/fontconfig-penultimate.nix57
1 files changed, 57 insertions, 0 deletions
diff --git a/nixos/modules/config/fonts/fontconfig-penultimate.nix b/nixos/modules/config/fonts/fontconfig-penultimate.nix
new file mode 100644
index 000000000000..8e41d3421173
--- /dev/null
+++ b/nixos/modules/config/fonts/fontconfig-penultimate.nix
@@ -0,0 +1,57 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+  cfg = config.fonts.fontconfig.penultimate;
+
+  latestVersion  = pkgs.fontconfig.configVersion;
+
+  # The configuration to be included in /etc/font/
+  confPkg = pkgs.runCommand "font-penultimate-conf" {} ''
+    support_folder=$out/etc/fonts/conf.d
+    latest_folder=$out/etc/fonts/${latestVersion}/conf.d
+
+    mkdir -p $support_folder
+    mkdir -p $latest_folder
+
+    # fontconfig ultimate various configuration files
+    ln -s ${pkgs.fontconfig-penultimate}/etc/fonts/conf.d/*.conf \
+          $support_folder
+    ln -s ${pkgs.fontconfig-penultimate}/etc/fonts/conf.d/*.conf \
+          $latest_folder
+  '';
+
+in
+{
+
+  options = {
+
+    fonts = {
+
+      fontconfig = {
+
+        penultimate = {
+          enable = mkOption {
+            type = types.bool;
+            default = true;
+            description = ''
+              Enable fontconfig-penultimate settings to supplement the
+              NixOS defaults by providing per-font rendering defaults and
+              metric aliases.
+            '';
+          };
+        };
+
+      };
+    };
+
+  };
+
+  config = mkIf (config.fonts.fontconfig.enable && cfg.enable) {
+
+    fonts.fontconfig.confPackages = [ confPkg ];
+
+  };
+
+}