kbd service: add system-wise console resources

This commit is contained in:
Nikolay Amiantov 2016-07-03 03:29:21 +03:00
parent 489bbf0609
commit 6c11d9dd55
2 changed files with 19 additions and 5 deletions

View File

@ -41,6 +41,15 @@ in
''; '';
}; };
consolePackages = mkOption {
type = types.listOf types.package;
default = [];
description = ''
List of additional packages that provide console fonts, keymaps and
other resources.
'';
};
consoleFont = mkOption { consoleFont = mkOption {
type = types.str; type = types.str;
default = "Lat2-Terminus16"; default = "Lat2-Terminus16";

View File

@ -13,6 +13,12 @@ let
${colors} ${colors}
''; '';
kbdEnv = pkgs.buildEnv {
name = "kbd-env";
paths = [ pkgs.kbd ] ++ config.i18n.consolePackages;
pathsToLink = [ "/share/consolefonts" "/share/consoletrans" "/share/keymaps" "/share/unimaps" ];
};
setVconsole = !config.boot.isContainer; setVconsole = !config.boot.isContainer;
in in
@ -53,10 +59,9 @@ in
# Let systemd-vconsole-setup.service do the work of setting up the # Let systemd-vconsole-setup.service do the work of setting up the
# virtual consoles. # virtual consoles.
environment.etc = [ { environment.etc."vconsole.conf".source = vconsoleConf;
target = "vconsole.conf"; # Provide kbd with additional packages.
source = vconsoleConf; environment.etc."kbd".source = "${kbdEnv}/share";
} ];
# This is identical to the systemd-vconsole-setup.service unit # This is identical to the systemd-vconsole-setup.service unit
# shipped with systemd, except that it uses /dev/tty1 instead of # shipped with systemd, except that it uses /dev/tty1 instead of
@ -66,7 +71,7 @@ in
{ wantedBy = [ "multi-user.target" ]; { wantedBy = [ "multi-user.target" ];
before = [ "display-manager.service" ]; before = [ "display-manager.service" ];
after = [ "systemd-udev-settle.service" ]; after = [ "systemd-udev-settle.service" ];
restartTriggers = [ vconsoleConf ]; restartTriggers = [ vconsoleConf kbdEnv ];
}; };
}) })
]; ];