From f40ae4293306628c0d5b4aaf78edb97a377e97af Mon Sep 17 00:00:00 2001 From: Jan Bulthuis Date: Thu, 18 Jul 2024 23:36:50 +0200 Subject: [PATCH] Font progress --- merged.nix | 110 +++++++++--------- modules/base/default.nix | 0 modules/brightnessctl/default.nix | 16 +++ modules/users/default.nix | 3 + modules/users/modules/theming/default.nix | 6 + modules/users/modules/theming/fonts/dina.nix | 1 + .../modules/theming/fonts/wqy-bitmapsong.nix | 8 ++ .../theming/fonts/wqy-microhei-mono.nix | 8 ++ .../modules/theming/fonts/wqy-microhei.nix | 8 ++ .../modules/theming/fonts/wqy-zenhei-mono.nix | 8 ++ .../theming/fonts/wqy-zenhei-sharp.nix | 8 ++ .../modules/theming/fonts/wqy-zenhei.nix | 1 + pkgs/default.nix | 33 +++--- users/jan.nix | 2 +- 14 files changed, 142 insertions(+), 70 deletions(-) create mode 100644 modules/base/default.nix create mode 100644 modules/brightnessctl/default.nix create mode 100644 modules/users/modules/theming/fonts/wqy-bitmapsong.nix create mode 100644 modules/users/modules/theming/fonts/wqy-microhei-mono.nix create mode 100644 modules/users/modules/theming/fonts/wqy-microhei.nix create mode 100644 modules/users/modules/theming/fonts/wqy-zenhei-mono.nix create mode 100644 modules/users/modules/theming/fonts/wqy-zenhei-sharp.nix diff --git a/merged.nix b/merged.nix index 20a7202..4bcbf81 100644 --- a/merged.nix +++ b/merged.nix @@ -15,69 +15,69 @@ let # sha256 = "0dz8h1ga8lnfvvmvsf6iqvnbvxrvx3qxi0y8s8b72066mqgvy8y5"; # }); - fontInstallPhase = '' - runHook preInstall + # fontInstallPhase = '' + # runHook preInstall - install -Dm644 *.ttc -t $out/share/fonts/ + # install -Dm644 *.ttc -t $out/share/fonts/ - runHook postInstall - ''; + # runHook postInstall + # ''; - my-wqy-zenhei = pkgs.stdenv.mkDerivation rec { - pname = "wqy-zenhei"; - version = "0.9.45"; + # my-wqy-zenhei = pkgs.stdenv.mkDerivation rec { + # pname = "wqy-zenhei"; + # version = "0.9.45"; - src = pkgs.fetchurl { - url = "mirror://sourceforge/wqy/${pname}-${version}.tar.gz"; - hash = "sha256-5LfjBkdb+UJ9F1dXjw5FKJMMhMROqj8WfUxC8RDuddY="; - }; + # src = pkgs.fetchurl { + # url = "mirror://sourceforge/wqy/${pname}-${version}.tar.gz"; + # hash = "sha256-5LfjBkdb+UJ9F1dXjw5FKJMMhMROqj8WfUxC8RDuddY="; + # }; - installPhase = fontInstallPhase; - }; + # installPhase = fontInstallPhase; + # }; - my-wqy-microhei = pkgs.stdenv.mkDerivation rec { - pname = "wqy-microhei"; - version = "0.2.0-beta"; + # my-wqy-microhei = pkgs.stdenv.mkDerivation rec { + # pname = "wqy-microhei"; + # version = "0.2.0-beta"; - src = pkgs.fetchurl { - url = "mirror://sourceforge/wqy/${pname}-${version}.tar.gz"; - hash = "sha256-KAKsgCOqNqZupudEWFTjoHjTd///QhaTQb0jeHH3IT4="; - }; + # src = pkgs.fetchurl { + # url = "mirror://sourceforge/wqy/${pname}-${version}.tar.gz"; + # hash = "sha256-KAKsgCOqNqZupudEWFTjoHjTd///QhaTQb0jeHH3IT4="; + # }; - installPhase = fontInstallPhase; - }; + # installPhase = fontInstallPhase; + # }; - my-wqy-bitmapsong = pkgs.stdenv.mkDerivation rec { - pname = "wqy-bitmapsong-pcf"; - version = "1.0.0-RC1"; + # my-wqy-bitmapsong = pkgs.stdenv.mkDerivation rec { + # pname = "wqy-bitmapsong-pcf"; + # version = "1.0.0-RC1"; - src = pkgs.fetchurl { - url = "mirror://sourceforge/wqy/${pname}-${version}.tar.gz"; - #hash = "sha256-r2Vf7ftJCqu7jOc2AqCKaoR/r8eNw2P/OQGqbDOEyl0="; - hash = "sha256-0uvwkRUbvJ0remTnlP8dElRjaBVd6iukNYBTE/CTO7s="; - }; + # src = pkgs.fetchurl { + # url = "mirror://sourceforge/wqy/${pname}-${version}.tar.gz"; + # #hash = "sha256-r2Vf7ftJCqu7jOc2AqCKaoR/r8eNw2P/OQGqbDOEyl0="; + # hash = "sha256-0uvwkRUbvJ0remTnlP8dElRjaBVd6iukNYBTE/CTO7s="; + # }; - buildInputs = [ pkgs.fontforge ]; - buildPhase = '' - newName() { - test "''${1:5:1}" = i && _it=Italic || _it= - case ''${1:6:3} in - 400) test -z $it && _weight=Medium ;; - 700) _weight=Bold ;; - esac - _pt=''${1%.pcf} - _pt=''${_pt#*-} - echo "WenQuanYi_Bitmap_Song$_weight$_it$_pt" - } + # buildInputs = [ pkgs.fontforge ]; + # buildPhase = '' + # newName() { + # test "''${1:5:1}" = i && _it=Italic || _it= + # case ''${1:6:3} in + # 400) test -z $it && _weight=Medium ;; + # 700) _weight=Bold ;; + # esac + # _pt=''${1%.pcf} + # _pt=''${_pt#*-} + # echo "WenQuanYi_Bitmap_Song$_weight$_it$_pt" + # } - for i in *.pcf; do - fontforge -lang=ff -c "Open(\"$i\"); Generate(\"$(newName $i).otb\")" - done - ''; - installPhase = '' - install -Dm644 *.otb -t $out/share/fonts/ - ''; - }; + # for i in *.pcf; do + # fontforge -lang=ff -c "Open(\"$i\"); Generate(\"$(newName $i).otb\")" + # done + # ''; + # installPhase = '' + # install -Dm644 *.otb -t $out/share/fonts/ + # ''; + # }; in { # imports = # [ @@ -229,9 +229,9 @@ in { # Fonts fonts.packages = with pkgs; [ - my-wqy-zenhei - my-wqy-microhei - my-wqy-bitmapsong + # my-wqy-zenhei + # my-wqy-microhei + # my-wqy-bitmapsong # cozette #uw-ttyp0 #ucs-fonts @@ -275,10 +275,8 @@ in { environment.systemPackages = with pkgs; [ git vim - neovim wget curl - brightnessctl ]; # Some programs need SUID wrappers, can be configured further or are diff --git a/modules/base/default.nix b/modules/base/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/brightnessctl/default.nix b/modules/brightnessctl/default.nix new file mode 100644 index 0000000..9b0a210 --- /dev/null +++ b/modules/brightnessctl/default.nix @@ -0,0 +1,16 @@ +{config, lib, pkgs, ... }: + +with lib; +let + cfg = config.modules.brightnessctl; +in { + options.modules.brightnessctl = { + enable = mkEnableOption "brightnessctl"; + }; + + config = mkIf cfg.enable { + environment.systemPackages = [ + pkgs.brightnessctl + ]; + }; +} \ No newline at end of file diff --git a/modules/users/default.nix b/modules/users/default.nix index e38b11d..a2c17ff 100644 --- a/modules/users/default.nix +++ b/modules/users/default.nix @@ -64,6 +64,9 @@ in { # Modules ./modules/default.nix + + # Custom packages + ../../pkgs/default.nix ]; # Create users diff --git a/modules/users/modules/theming/default.nix b/modules/users/modules/theming/default.nix index 3071cf9..bdfffec 100644 --- a/modules/users/modules/theming/default.nix +++ b/modules/users/modules/theming/default.nix @@ -46,6 +46,12 @@ let ./fonts/fira-code.nix ./fonts/nerd-fonts-symbols.nix ./fonts/noto-color-emoji.nix + ./fonts/wqy-bitmapsong.nix + ./fonts/wqy-microhei-mono.nix + ./fonts/wqy-microhei.nix + ./fonts/wqy-zenhei-mono.nix + ./fonts/wqy-zenhei-sharp.nix + ./fonts/wqy-zenhei.nix ]; # Gather enabled fonts. diff --git a/modules/users/modules/theming/fonts/dina.nix b/modules/users/modules/theming/fonts/dina.nix index 3d4e801..3b49870 100644 --- a/modules/users/modules/theming/fonts/dina.nix +++ b/modules/users/modules/theming/fonts/dina.nix @@ -6,6 +6,7 @@ recommendedSize = 9; fallbackFonts = [ "Cozette" + "wenquanyi bitmap song" "Symbols Nerd Font Mono" ]; } \ No newline at end of file diff --git a/modules/users/modules/theming/fonts/wqy-bitmapsong.nix b/modules/users/modules/theming/fonts/wqy-bitmapsong.nix new file mode 100644 index 0000000..6537b07 --- /dev/null +++ b/modules/users/modules/theming/fonts/wqy-bitmapsong.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: + +{ + name = "wenquanyi bitmap song"; + package = pkgs.wqy-bitmapsong; + recommendedSize = 12; + fallbackFonts = []; +} \ No newline at end of file diff --git a/modules/users/modules/theming/fonts/wqy-microhei-mono.nix b/modules/users/modules/theming/fonts/wqy-microhei-mono.nix new file mode 100644 index 0000000..3d49fca --- /dev/null +++ b/modules/users/modules/theming/fonts/wqy-microhei-mono.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: + +{ + name = "WenQuanYi Micro Hei Mono"; + package = pkgs.wqy-microhei; + recommendedSize = 12; + fallbackFonts = []; +} \ No newline at end of file diff --git a/modules/users/modules/theming/fonts/wqy-microhei.nix b/modules/users/modules/theming/fonts/wqy-microhei.nix new file mode 100644 index 0000000..1eff1e6 --- /dev/null +++ b/modules/users/modules/theming/fonts/wqy-microhei.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: + +{ + name = "WenQuanYi Micro Hei"; + package = pkgs.wqy-microhei; + recommendedSize = 12; + fallbackFonts = []; +} \ No newline at end of file diff --git a/modules/users/modules/theming/fonts/wqy-zenhei-mono.nix b/modules/users/modules/theming/fonts/wqy-zenhei-mono.nix new file mode 100644 index 0000000..b945f7f --- /dev/null +++ b/modules/users/modules/theming/fonts/wqy-zenhei-mono.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: + +{ + name = "WenQuanYi Zen Hei Mono"; + package = pkgs.wqy-zenhei; + recommendedSize = 12; + fallbackFonts = []; +} \ No newline at end of file diff --git a/modules/users/modules/theming/fonts/wqy-zenhei-sharp.nix b/modules/users/modules/theming/fonts/wqy-zenhei-sharp.nix new file mode 100644 index 0000000..f632c51 --- /dev/null +++ b/modules/users/modules/theming/fonts/wqy-zenhei-sharp.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: + +{ + name = "WenQuanYi Zen Hei Sharp"; + package = pkgs.wqy-zenhei; + recommendedSize = 12; + fallbackFonts = []; +} \ No newline at end of file diff --git a/modules/users/modules/theming/fonts/wqy-zenhei.nix b/modules/users/modules/theming/fonts/wqy-zenhei.nix index a40eed2..05d8776 100644 --- a/modules/users/modules/theming/fonts/wqy-zenhei.nix +++ b/modules/users/modules/theming/fonts/wqy-zenhei.nix @@ -2,6 +2,7 @@ { name = "WenQuanYi Zen Hei"; + package = pkgs.wqy-zenhei; recommendedSize = 12; fallbackFonts = []; } \ No newline at end of file diff --git a/pkgs/default.nix b/pkgs/default.nix index 66a9b18..7581942 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,17 +1,24 @@ { lib, config, pkgs, ... }: with lib; -let - mkPackage = path: (mkOption { - type = types.package; - default = (pkgs.callPackage path) {}; - description = (mkPackage path).default.name; - }); -in { - options.pkgs = { - # Add all custom packages - wqy-zenhei = mkPackage ./fonts/wqy-zenhei.nix; - wqy-microhei = mkPackage ./fonts/wqy-microhei.nix; - wqy-bitmapsong = mkPackage ./fonts/wqy-bitmapsong.nix; - }; +# let +# mkPackage = path: (mkOption { +# type = types.package; +# default = (pkgs.callPackage path) {}; +# description = (mkPackage path).default.name; +# }); +# in { +# options.pkgs = { +# # Add all custom packages +# wqy-zenhei = mkPackage ./fonts/wqy-zenhei.nix; +# wqy-microhei = mkPackage ./fonts/wqy-microhei.nix; +# wqy-bitmapsong = mkPackage ./fonts/wqy-bitmapsong.nix; +# }; +# } +{ + nixpkgs.config.packageOverrides = pkgs: rec { + wqy-zenhei = pkgs.callPackage ./fonts/wqy-zenhei.nix {}; + wqy-microhei = pkgs.callPackage ./fonts/wqy-microhei.nix {}; + wqy-bitmapsong = pkgs.callPackage ./fonts/wqy-bitmapsong.nix {}; + }; } \ No newline at end of file diff --git a/users/jan.nix b/users/jan.nix index ec3e425..4ab5ff4 100644 --- a/users/jan.nix +++ b/users/jan.nix @@ -1,6 +1,6 @@ # How Jan likes his linux to be configured -{ config, ... }: +{ config, pkgs, ... }: { # TODO: Remove later