mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-07 20:53:22 +00:00
nixos/kmscon: Add fonts option
This commit is contained in:
parent
ff9efb0724
commit
11bbb28f8a
@ -1,6 +1,6 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib) mkOption types mkIf;
|
inherit (lib) mapAttrs mkIf mkOption optional optionals types;
|
||||||
|
|
||||||
cfg = config.services.kmscon;
|
cfg = config.services.kmscon;
|
||||||
|
|
||||||
@ -28,6 +28,19 @@ in {
|
|||||||
default = false;
|
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 {
|
extraConfig = mkOption {
|
||||||
description = "Extra contents of the kmscon.conf file.";
|
description = "Extra contents of the kmscon.conf file.";
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
@ -87,11 +100,17 @@ in {
|
|||||||
|
|
||||||
systemd.services.systemd-vconsole-setup.enable = false;
|
systemd.services.systemd-vconsole-setup.enable = false;
|
||||||
|
|
||||||
services.kmscon.extraConfig = mkIf cfg.hwRender ''
|
services.kmscon.extraConfig =
|
||||||
drm
|
let
|
||||||
hwaccel
|
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;
|
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