about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2024-12-28 16:21:48 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2024-12-28 19:30:25 +0100
commitce5235a66ea52e0ea7972a0b01e19400851ed200 (patch)
treed27cf37582fe0aeb1a4e842317f4c2b630cc5468 /modules
parentFix update changes (diff)
downloadnixos-config-ce5235a66ea52e0ea7972a0b01e19400851ed200.tar.gz
nixos-config-ce5235a66ea52e0ea7972a0b01e19400851ed200.tar.bz2
nixos-config-ce5235a66ea52e0ea7972a0b01e19400851ed200.zip
Font: Add new font
Diffstat (limited to 'modules')
-rw-r--r--modules/fonts/berkeley-mono/default.nix43
-rw-r--r--modules/fonts/default.nix32
2 files changed, 68 insertions, 7 deletions
diff --git a/modules/fonts/berkeley-mono/default.nix b/modules/fonts/berkeley-mono/default.nix
new file mode 100644
index 0000000..3375217
--- /dev/null
+++ b/modules/fonts/berkeley-mono/default.nix
@@ -0,0 +1,43 @@
+{
+  lib,
+  requireFile,
+  unzip,
+  stdenvNoCC,
+}:
+stdenvNoCC.mkDerivation (finalAttrs: {
+  pname = "berkeley-mono";
+  version = "1";
+
+  src = ../../../secrets/berkeley-mono.zip;
+
+  outputs = [
+    "out"
+    "web"
+    "variable"
+    "variableweb"
+  ];
+
+  nativeBuildInputs = [
+    unzip
+  ];
+
+  unpackPhase = ''
+    unzip $src
+  '';
+
+  installPhase = ''
+    install -m444 -Dt $out/share/fonts/truetype/berkeley-mono berkeley-mono/TTF/*.ttf
+    install -m444 -Dt $out/share/fonts/opentype/berkeley-mono berkeley-mono/OTF/*.otf
+    install -m444 -Dt $web/share/fonts/webfonts/berkeley-mono berkeley-mono/WEB/*.woff2
+    install -m444 -Dt $variable/share/fonts/truetype/berkeley-mono berkeley-mono-variable/TTF/*.ttf
+    install -m444 -Dt $variableweb/share/fonts/webfonts/berkeley-mono berkeley-mono-variable/WEB/*.woff2
+  '';
+
+  meta = {
+    description = "Berkeley Mono Typeface";
+    longDescription = "…";
+    homepage = "https://berkeleygraphics.com/typefaces/berkeley-mono";
+    license = lib.licenses.unfree;
+    platforms = lib.platforms.all;
+  };
+})
diff --git a/modules/fonts/default.nix b/modules/fonts/default.nix
index a91ee0f..9c4cf45 100644
--- a/modules/fonts/default.nix
+++ b/modules/fonts/default.nix
@@ -1,9 +1,27 @@
 { config, pkgs, ... }: {
-  fonts.packages = with pkgs; [
-    noto-fonts
-    noto-fonts-cjk-sans
-    noto-fonts-emoji
-    nerd-fonts.inconsolata-lgc
-    nerd-fonts.noto
-  ];
+  fonts = {
+    packages = with pkgs; [
+      noto-fonts
+      noto-fonts-cjk-sans
+      noto-fonts-emoji
+      nerd-fonts.inconsolata-lgc
+      nerd-fonts.noto
+      (pkgs.callPackage ./berkeley-mono {})
+    ];
+    fontconfig = {
+      defaultFonts = {
+        monospace = [ "Berkeley Mono" "Inconsolata LGC" ];
+      };
+    #   localConf = ''
+    #   <?xml version="1.0"?>
+    #   <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+    #   <fontconfig>
+    #      <match target="pattern">
+    #         <test qual="any" name="family" compare="eq"><string>Berkeley Mono</string></test>
+    #         <edit name="family" mode="assign" binding="same"><string>Inconsolata LGC</string></edit>
+    #      </match>
+    #   </fontconfig>
+    # '';
+    };
+  };
 }