blob: 97fe7a1ca1b84f0e9fe56cd312ec1ca5ea297141 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
{ config, pkgs, ... }:
let
inherit (pkgs.lib) mkOption types mkIf optionalString;
cfg = config.services.kmscon;
configDir = pkgs.writeTextFile { name = "kmscon-config"; destination = "/kmscon.conf"; text = cfg.extraConfig; };
in {
options = {
services.kmscon = {
enable = mkOption {
description = "Use kmscon as the virtual console instead of gettys";
type = types.bool;
default = false;
};
hwRender = mkOption {
description = "Whether to use 3D hardware acceleration to render the console";
type = types.bool;
default = false;
};
extraConfig = mkOption {
description = "Extra contents of the kmscon.conf file";
type = types.lines;
default = "";
example = "font-size=14";
};
};
};
config = mkIf cfg.enable {
# Largely copied from unit provided with kmscon source
systemd.units."kmsconvt@.service".text = ''
[Unit]
Description=KMS System Console on %I
Documentation=man:kmscon(1)
After=systemd-user-sessions.service
After=plymouth-quit-wait.service
After=systemd-logind.service
Requires=systemd-logind.service
Before=getty.target
Conflicts=getty@%i.service
OnFailure=getty@%i.service
IgnoreOnIsolate=yes
ConditionPathExists=/dev/tty0
[Service]
ExecStart=${pkgs.kmscon}/bin/kmscon "--vt=%I" --seats=seat0 --no-switchvt --configdir ${configDir} --login -- ${pkgs.shadow}/bin/login -p
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
'';
systemd.units."autovt@.service".linkTarget = "${config.systemd.units."kmsconvt@.service".unit}/kmsconvt@.service";
services.kmscon.extraConfig = mkIf cfg.hwRender ''
drm
hwaccel
'';
};
}
|