mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-01 01:33:20 +00:00
nixos/kmscon: Add fonts option
This commit is contained in:
parent
ff9efb0724
commit
11bbb28f8a
@ -1,6 +1,6 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
inherit (lib) mkOption types mkIf;
|
||||
inherit (lib) mapAttrs mkIf mkOption optional optionals types;
|
||||
|
||||
cfg = config.services.kmscon;
|
||||
|
||||
@ -28,6 +28,19 @@ in {
|
||||
default = false;
|
||||
};
|
||||
|
||||
fonts = mkOption {
|
||||
description = "Fonts used by kmscon, in order of priority.";
|
||||
default = null;
|
||||
example = lib.literalExpression ''[ { name = "Source Code Pro"; package = pkgs.source-code-pro; } ]'';
|
||||
type = with types;
|
||||
let fontType = submodule {
|
||||
options = {
|
||||
name = mkOption { type = str; description = "Font name, as used by fontconfig."; };
|
||||
package = mkOption { type = package; description = "Package providing the font."; };
|
||||
};
|
||||
}; in nullOr (nonEmptyListOf fontType);
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
description = "Extra contents of the kmscon.conf file.";
|
||||
type = types.lines;
|
||||
@ -87,11 +100,17 @@ in {
|
||||
|
||||
systemd.services.systemd-vconsole-setup.enable = false;
|
||||
|
||||
services.kmscon.extraConfig = mkIf cfg.hwRender ''
|
||||
drm
|
||||
hwaccel
|
||||
'';
|
||||
services.kmscon.extraConfig =
|
||||
let
|
||||
render = optionals cfg.hwRender [ "drm" "hwaccel" ];
|
||||
fonts = optional (cfg.fonts != null) "font-name=${lib.concatMapStringsSep ", " (f: f.name) cfg.fonts}";
|
||||
in lib.concatStringsSep "\n" (render ++ fonts);
|
||||
|
||||
hardware.opengl.enable = mkIf cfg.hwRender true;
|
||||
|
||||
fonts = mkIf (cfg.fonts != null) {
|
||||
fontconfig.enable = true;
|
||||
fonts = map (f: f.package) cfg.fonts;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user