diff options
author | asymmetric <lorenzo@mailbox.org> | 2023-07-25 09:49:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-25 09:49:25 +0200 |
commit | 46df012d2a0a49d6c9ad8852f9a376622e3376ab (patch) | |
tree | f01d9374a934623892a21be2accd1531501a55b3 /nixos/modules | |
parent | 9516089caec5389f2f7e03acf50e4ef2912bb3e9 (diff) | |
parent | 83793ca8980283a6f62c028ebed336b9d1bbf80f (diff) | |
download | nixlib-46df012d2a0a49d6c9ad8852f9a376622e3376ab.tar nixlib-46df012d2a0a49d6c9ad8852f9a376622e3376ab.tar.gz nixlib-46df012d2a0a49d6c9ad8852f9a376622e3376ab.tar.bz2 nixlib-46df012d2a0a49d6c9ad8852f9a376622e3376ab.tar.lz nixlib-46df012d2a0a49d6c9ad8852f9a376622e3376ab.tar.xz nixlib-46df012d2a0a49d6c9ad8852f9a376622e3376ab.tar.zst nixlib-46df012d2a0a49d6c9ad8852f9a376622e3376ab.zip |
Merge pull request #244332 from SuperSandro2000/fonts-fonts
nixos/fonts: rename fonts.fonts option to fonts.packages, other cleanups
Diffstat (limited to 'nixos/modules')
21 files changed, 75 insertions, 89 deletions
diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix index 2eee5cd34d06..5e2e054f7c4e 100644 --- a/nixos/modules/config/fonts/fontconfig.nix +++ b/nixos/modules/config/fonts/fontconfig.nix @@ -42,7 +42,7 @@ let # looking things up. makeCacheConf = { }: let - makeCache = fontconfig: pkgs.makeFontsCache { inherit fontconfig; fontDirectories = config.fonts.fonts; }; + makeCache = fontconfig: pkgs.makeFontsCache { inherit fontconfig; fontDirectories = config.fonts.packages; }; cache = makeCache pkgs.fontconfig; cache32 = makeCache pkgs.pkgsi686Linux.fontconfig; in @@ -51,7 +51,7 @@ let <!DOCTYPE fontconfig SYSTEM 'urn:fontconfig:fonts.dtd'> <fontconfig> <!-- Font directories --> - ${concatStringsSep "\n" (map (font: "<dir>${font}</dir>") config.fonts.fonts)} + ${concatStringsSep "\n" (map (font: "<dir>${font}</dir>") config.fonts.packages)} ${optionalString (pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform) '' <!-- Pre-generated font caches --> <cachedir>${cache}</cachedir> diff --git a/nixos/modules/config/fonts/fontdir.nix b/nixos/modules/config/fonts/fontdir.nix index 9d41463c9470..3b5eaf5b2d7f 100644 --- a/nixos/modules/config/fonts/fontdir.nix +++ b/nixos/modules/config/fonts/fontdir.nix @@ -9,7 +9,7 @@ let x11Fonts = pkgs.runCommand "X11-fonts" { preferLocalBuild = true; } '' mkdir -p "$out/share/X11/fonts" font_regexp='.*\.\(ttf\|ttc\|otb\|otf\|pcf\|pfa\|pfb\|bdf\)\(\.gz\)?' - find ${toString config.fonts.fonts} -regex "$font_regexp" \ + find ${toString config.fonts.packages} -regex "$font_regexp" \ -exec ln -sf -t "$out/share/X11/fonts" '{}' \; cd "$out/share/X11/fonts" ${optionalString cfg.decompressFonts '' diff --git a/nixos/modules/config/fonts/fonts.nix b/nixos/modules/config/fonts/fonts.nix deleted file mode 100644 index 87cf837e7c80..000000000000 --- a/nixos/modules/config/fonts/fonts.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - cfg = config.fonts; - - defaultFonts = - [ pkgs.dejavu_fonts - pkgs.freefont_ttf - pkgs.gyre-fonts # TrueType substitutes for standard PostScript fonts - pkgs.liberation_ttf - pkgs.unifont - pkgs.noto-fonts-emoji - ]; -in -{ - imports = [ - (mkRemovedOptionModule [ "fonts" "enableCoreFonts" ] "Use fonts.fonts = [ pkgs.corefonts ]; instead.") - ]; - - options = { - - fonts = { - - # TODO: find another name for it. - fonts = mkOption { - type = types.listOf types.path; - default = []; - example = literalExpression "[ pkgs.dejavu_fonts ]"; - description = lib.mdDoc "List of primary font paths."; - }; - - enableDefaultFonts = mkOption { - type = types.bool; - default = false; - description = lib.mdDoc '' - Enable a basic set of fonts providing several font styles - and families and reasonable coverage of Unicode. - ''; - }; - }; - - }; - - config = { fonts.fonts = mkIf cfg.enableDefaultFonts defaultFonts; }; -} diff --git a/nixos/modules/config/fonts/ghostscript.nix b/nixos/modules/config/fonts/ghostscript.nix index c284c4a0b0ab..c41fcdaaa329 100644 --- a/nixos/modules/config/fonts/ghostscript.nix +++ b/nixos/modules/config/fonts/ghostscript.nix @@ -3,31 +3,21 @@ with lib; { - options = { - - fonts = { - - enableGhostscriptFonts = mkOption { - type = types.bool; - default = false; - description = lib.mdDoc '' - Whether to add the fonts provided by Ghostscript (such as - various URW fonts and the “Base-14” Postscript fonts) to the - list of system fonts, making them available to X11 - applications. - ''; - }; - + fonts.enableGhostscriptFonts = mkOption { + type = types.bool; + default = false; + description = lib.mdDoc '' + Whether to add the fonts provided by Ghostscript (such as + various URW fonts and the “Base-14” Postscript fonts) to the + list of system fonts, making them available to X11 + applications. + ''; }; }; - config = mkIf config.fonts.enableGhostscriptFonts { - - fonts.fonts = [ "${pkgs.ghostscript}/share/ghostscript/fonts" ]; - + fonts.packages = [ "${pkgs.ghostscript}/share/ghostscript/fonts" ]; }; - } diff --git a/nixos/modules/config/fonts/packages.nix b/nixos/modules/config/fonts/packages.nix new file mode 100644 index 000000000000..8929539b921e --- /dev/null +++ b/nixos/modules/config/fonts/packages.nix @@ -0,0 +1,43 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.fonts; +in +{ + imports = [ + (lib.mkRemovedOptionModule [ "fonts" "enableCoreFonts" ] "Use fonts.packages = [ pkgs.corefonts ]; instead.") + (lib.mkRenamedOptionModule [ "fonts" "enableDefaultFonts " ] [ "fonts" "enableDefaultPackages" ]) + (lib.mkRenamedOptionModule [ "fonts" "fonts" ] [ "fonts" "packages" ]) + ]; + + options = { + fonts = { + packages = lib.mkOption { + type = with lib.types; listOf path; + default = []; + example = lib.literalExpression "[ pkgs.dejavu_fonts ]"; + description = lib.mdDoc "List of primary font packages."; + }; + + enableDefaultPackages = lib.mkOption { + type = lib.types.bool; + default = false; + description = lib.mdDoc '' + Enable a basic set of fonts providing several styles + and families and reasonable coverage of Unicode. + ''; + }; + }; + }; + + config = { + fonts.packages = lib.mkIf cfg.enableDefaultPackages (with pkgs; [ + dejavu_fonts + freefont_ttf + gyre-fonts # TrueType substitutes for standard PostScript fonts + liberation_ttf + unifont + noto-fonts-emoji + ]); + }; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index e6b6d2487d98..3fd466bf846c 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -4,8 +4,8 @@ ./config/debug-info.nix ./config/fonts/fontconfig.nix ./config/fonts/fontdir.nix - ./config/fonts/fonts.nix ./config/fonts/ghostscript.nix + ./config/fonts/packages.nix ./config/gnu.nix ./config/gtk/gtk-icon-cache.nix ./config/i18n.nix diff --git a/nixos/modules/programs/hyprland.nix b/nixos/modules/programs/hyprland.nix index d79680f63f16..faeaa8973fa9 100644 --- a/nixos/modules/programs/hyprland.nix +++ b/nixos/modules/programs/hyprland.nix @@ -60,7 +60,7 @@ in config = mkIf cfg.enable { environment.systemPackages = [ cfg.finalPackage ]; - fonts.enableDefaultFonts = mkDefault true; + fonts.enableDefaultPackages = mkDefault true; hardware.opengl.enable = mkDefault true; programs = { diff --git a/nixos/modules/programs/miriway.nix b/nixos/modules/programs/miriway.nix index a67e1a17a7e6..e8a10770b6a3 100644 --- a/nixos/modules/programs/miriway.nix +++ b/nixos/modules/programs/miriway.nix @@ -66,7 +66,7 @@ in { }; hardware.opengl.enable = lib.mkDefault true; - fonts.enableDefaultFonts = lib.mkDefault true; + fonts.enableDefaultPackages = lib.mkDefault true; programs.dconf.enable = lib.mkDefault true; programs.xwayland.enable = lib.mkDefault true; diff --git a/nixos/modules/programs/wayland/wayland-session.nix b/nixos/modules/programs/wayland/wayland-session.nix index 3cbfef4d61de..da117ceae0ad 100644 --- a/nixos/modules/programs/wayland/wayland-session.nix +++ b/nixos/modules/programs/wayland/wayland-session.nix @@ -5,7 +5,7 @@ }; hardware.opengl.enable = mkDefault true; - fonts.enableDefaultFonts = mkDefault true; + fonts.enableDefaultPackages = mkDefault true; programs = { dconf.enable = mkDefault true; diff --git a/nixos/modules/services/monitoring/munin.nix b/nixos/modules/services/monitoring/munin.nix index 9461bd3f35b8..f37f2689927e 100644 --- a/nixos/modules/services/monitoring/munin.nix +++ b/nixos/modules/services/monitoring/munin.nix @@ -375,7 +375,7 @@ in # Munin is hardcoded to use DejaVu Mono and the graphs come out wrong if # it's not available. - fonts.fonts = [ pkgs.dejavu_fonts ]; + fonts.packages = [ pkgs.dejavu_fonts ]; systemd.timers.munin-cron = { description = "batch Munin master programs"; diff --git a/nixos/modules/services/networking/xrdp.nix b/nixos/modules/services/networking/xrdp.nix index ed7f1dadd370..218b440aab3c 100644 --- a/nixos/modules/services/networking/xrdp.nix +++ b/nixos/modules/services/networking/xrdp.nix @@ -121,7 +121,7 @@ in icons.enable = true; }; - fonts.enableDefaultFonts = mkDefault true; + fonts.enableDefaultPackages = mkDefault true; systemd = { services.xrdp = { diff --git a/nixos/modules/services/ttys/kmscon.nix b/nixos/modules/services/ttys/kmscon.nix index 1d98e7ddacc8..0a12ef48d084 100644 --- a/nixos/modules/services/ttys/kmscon.nix +++ b/nixos/modules/services/ttys/kmscon.nix @@ -111,7 +111,7 @@ in { fonts = mkIf (cfg.fonts != null) { fontconfig.enable = true; - fonts = map (f: f.package) cfg.fonts; + packages = map (f: f.package) cfg.fonts; }; }; } diff --git a/nixos/modules/services/x11/desktop-managers/budgie.nix b/nixos/modules/services/x11/desktop-managers/budgie.nix index b7341d4d8b49..a734bc288c9f 100644 --- a/nixos/modules/services/x11/desktop-managers/budgie.nix +++ b/nixos/modules/services/x11/desktop-managers/budgie.nix @@ -156,7 +156,7 @@ in { ++ cfg.sessionPath; # Fonts. - fonts.fonts = mkDefault [ + fonts.packages = mkDefault [ pkgs.noto-fonts pkgs.hack-font ]; diff --git a/nixos/modules/services/x11/desktop-managers/cinnamon.nix b/nixos/modules/services/x11/desktop-managers/cinnamon.nix index c7755aca4bb5..b3cbe4c324df 100644 --- a/nixos/modules/services/x11/desktop-managers/cinnamon.nix +++ b/nixos/modules/services/x11/desktop-managers/cinnamon.nix @@ -218,7 +218,7 @@ in qt.style = "adwaita"; # Default Fonts - fonts.fonts = with pkgs; [ + fonts.packages = with pkgs; [ source-code-pro # Default monospace font in 3.32 ubuntu_font_family # required for default theme ]; diff --git a/nixos/modules/services/x11/desktop-managers/deepin.nix b/nixos/modules/services/x11/desktop-managers/deepin.nix index 70be6ed7c05e..b2369e2426f8 100644 --- a/nixos/modules/services/x11/desktop-managers/deepin.nix +++ b/nixos/modules/services/x11/desktop-managers/deepin.nix @@ -67,7 +67,7 @@ in networking.networkmanager.enable = mkDefault true; programs.dconf.enable = mkDefault true; - fonts.fonts = with pkgs; [ noto-fonts ]; + fonts.packages = with pkgs; [ noto-fonts ]; xdg.mime.enable = true; xdg.menus.enable = true; xdg.icons.enable = true; diff --git a/nixos/modules/services/x11/desktop-managers/enlightenment.nix b/nixos/modules/services/x11/desktop-managers/enlightenment.nix index 2de5d845d68b..1512b5fdf8a0 100644 --- a/nixos/modules/services/x11/desktop-managers/enlightenment.nix +++ b/nixos/modules/services/x11/desktop-managers/enlightenment.nix @@ -92,7 +92,7 @@ in environment.etc."X11/xkb".source = xcfg.xkbDir; - fonts.fonts = [ pkgs.dejavu_fonts pkgs.ubuntu_font_family ]; + fonts.packages = [ pkgs.dejavu_fonts pkgs.ubuntu_font_family ]; services.udisks2.enable = true; services.upower.enable = config.powerManagement.enable; diff --git a/nixos/modules/services/x11/desktop-managers/gnome.nix b/nixos/modules/services/x11/desktop-managers/gnome.nix index 79b2e7c6ead7..5d950f7d7fc5 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome.nix @@ -432,7 +432,7 @@ in isSystem = true; }; - fonts.fonts = with pkgs; [ + fonts.packages = with pkgs; [ cantarell-fonts dejavu_fonts source-code-pro # Default monospace font in 3.32 diff --git a/nixos/modules/services/x11/desktop-managers/pantheon.nix b/nixos/modules/services/x11/desktop-managers/pantheon.nix index e87ae5ae8124..2b4ee516aa19 100644 --- a/nixos/modules/services/x11/desktop-managers/pantheon.nix +++ b/nixos/modules/services/x11/desktop-managers/pantheon.nix @@ -265,7 +265,7 @@ in qt.style = "adwaita"; # Default Fonts - fonts.fonts = with pkgs; [ + fonts.packages = with pkgs; [ inter open-dyslexic open-sans @@ -306,7 +306,7 @@ in ])) config.environment.pantheon.excludePackages; # needed by screenshot - fonts.fonts = [ + fonts.packages = [ pkgs.pantheon.elementary-redacted-script ]; }) diff --git a/nixos/modules/services/x11/desktop-managers/plasma5.nix b/nixos/modules/services/x11/desktop-managers/plasma5.nix index 38f932ffb420..15a510fd8f96 100644 --- a/nixos/modules/services/x11/desktop-managers/plasma5.nix +++ b/nixos/modules/services/x11/desktop-managers/plasma5.nix @@ -332,7 +332,7 @@ in # Enable GTK applications to load SVG icons services.xserver.gdk-pixbuf.modulePackages = [ pkgs.librsvg ]; - fonts.fonts = with pkgs; [ cfg.notoPackage hack-font ]; + fonts.packages = with pkgs; [ cfg.notoPackage hack-font ]; fonts.fontconfig.defaultFonts = { monospace = [ "Hack" "Noto Sans Mono" ]; sansSerif = [ "Noto Sans" ]; diff --git a/nixos/modules/services/x11/display-managers/lightdm-greeters/slick.nix b/nixos/modules/services/x11/display-managers/lightdm-greeters/slick.nix index 4456374cc569..ee9b4016c8ef 100644 --- a/nixos/modules/services/x11/display-managers/lightdm-greeters/slick.nix +++ b/nixos/modules/services/x11/display-managers/lightdm-greeters/slick.nix @@ -142,7 +142,7 @@ in theme ]; - fonts.fonts = [ font ]; + fonts.packages = [ font ]; environment.etc."lightdm/slick-greeter.conf".source = slickGreeterConf; }; diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index 53d9c99b47d0..c2e6da4b453b 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -22,7 +22,7 @@ let }; fontsForXServer = - config.fonts.fonts ++ + config.fonts.packages ++ # We don't want these fonts in fonts.conf, because then modern, # fontconfig-based applications will get horrible bitmapped # Helvetica fonts. It's better to get a substitution (like Nimbus @@ -883,8 +883,8 @@ in ${cfg.extraConfig} ''; - fonts.enableDefaultFonts = mkDefault true; - fonts.fonts = [ + fonts.enableDefaultPackages = mkDefault true; + fonts.packages = [ (if cfg.upscaleDefaultCursor then fontcursormisc_hidpi else pkgs.xorg.fontcursormisc) pkgs.xorg.fontmiscmisc ]; |