1{ config, lib, pkgs, ... }:
2
3with lib;
4
5{
6 ###### interface
7
8 options = {
9
10 services.klogd.enable = mkOption {
11 type = types.bool;
12 default = versionOlder (getVersion config.boot.kernelPackages.kernel) "3.5";
13 description = ''
14 Whether to enable klogd, the kernel log message processing
15 daemon. Since systemd handles logging of kernel messages on
16 Linux 3.5 and later, this is only useful if you're running an
17 older kernel.
18 '';
19 };
20
21 };
22
23
24 ###### implementation
25
26 config = mkIf config.services.klogd.enable {
27 systemd.services.klogd = {
28 description = "Kernel Log Daemon";
29 wantedBy = [ "multi-user.target" ];
30 path = [ pkgs.sysklogd ];
31 unitConfig.ConditionVirtualization = "!systemd-nspawn";
32 script =
33 "klogd -c 1 -2 -n " +
34 "-k $(dirname $(readlink -f /run/booted-system/kernel))/System.map";
35 };
36 };
37}