diff options
author | Sandro Jäckel <sandro.jaeckel@gmail.com> | 2023-07-19 13:41:53 +0200 |
---|---|---|
committer | Sandro Jäckel <sandro.jaeckel@gmail.com> | 2023-07-24 17:34:37 +0200 |
commit | 5162df32399c7e9d77cc38702202983dbe9ad113 (patch) | |
tree | 49d07c8cd5acf4882640d7a41674892b1aff0020 /nixos/modules/config/fonts | |
parent | 54d3317d12c539b0c267c8c3bc13aa3858da6ed7 (diff) |
nixos/fonts: rename fonts.fonts option to fonts.packages, other cleanups
fonts.fonts is not a great name and this also resolves a TODO.
Diffstat (limited to 'nixos/modules/config/fonts')
-rw-r--r-- | nixos/modules/config/fonts/fonts.nix | 47 | ||||
-rw-r--r-- | nixos/modules/config/fonts/packages.nix | 42 |
2 files changed, 42 insertions, 47 deletions
diff --git a/nixos/modules/config/fonts/fonts.nix b/nixos/modules/config/fonts/fonts.nix deleted file mode 100644 index 87cf837e7c80c..0000000000000 --- 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/packages.nix b/nixos/modules/config/fonts/packages.nix new file mode 100644 index 0000000000000..cedac766fc6ee --- /dev/null +++ b/nixos/modules/config/fonts/packages.nix @@ -0,0 +1,42 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.fonts; +in +{ + imports = [ + (lib.mkRemovedOptionModule [ "fonts" "enableCoreFonts" ] "Use fonts.packages = [ pkgs.corefonts ]; instead.") + (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."; + }; + + enableDefaultFonts = 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.enableDefaultFonts (with pkgs; [ + dejavu_fonts + freefont_ttf + gyre-fonts # TrueType substitutes for standard PostScript fonts + liberation_ttf + unifont + noto-fonts-emoji + ]); + }; +} |