2014-04-14 15:26:48 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2008-05-08 14:47:44 +01:00
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
with lib;
|
2009-10-12 17:36:19 +01:00
|
|
|
|
2008-05-08 14:47:44 +01:00
|
|
|
{
|
2012-10-05 18:44:15 +01:00
|
|
|
###### interface
|
2008-05-08 14:47:44 +01:00
|
|
|
|
2012-10-05 18:44:15 +01:00
|
|
|
options = {
|
2009-10-12 17:36:19 +01:00
|
|
|
|
2012-10-05 18:44:15 +01:00
|
|
|
services.klogd.enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = versionOlder (getVersion config.boot.kernelPackages.kernel) "3.5";
|
2021-11-26 00:16:05 +00:00
|
|
|
defaultText = literalExpression ''versionOlder (getVersion config.boot.kernelPackages.kernel) "3.5"'';
|
2012-10-05 18:44:15 +01:00
|
|
|
description = ''
|
|
|
|
Whether to enable klogd, the kernel log message processing
|
|
|
|
daemon. Since systemd handles logging of kernel messages on
|
|
|
|
Linux 3.5 and later, this is only useful if you're running an
|
|
|
|
older kernel.
|
|
|
|
'';
|
|
|
|
};
|
2009-10-12 17:36:19 +01:00
|
|
|
|
2012-10-05 18:44:15 +01:00
|
|
|
};
|
2011-11-25 16:32:54 +00:00
|
|
|
|
2012-10-05 18:44:15 +01:00
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf config.services.klogd.enable {
|
2016-01-06 06:50:18 +00:00
|
|
|
systemd.services.klogd = {
|
|
|
|
description = "Kernel Log Daemon";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
path = [ pkgs.sysklogd ];
|
|
|
|
unitConfig.ConditionVirtualization = "!systemd-nspawn";
|
|
|
|
script =
|
|
|
|
"klogd -c 1 -2 -n " +
|
|
|
|
"-k $(dirname $(readlink -f /run/booted-system/kernel))/System.map";
|
|
|
|
};
|
2012-10-05 18:44:15 +01:00
|
|
|
};
|
2008-05-08 14:47:44 +01:00
|
|
|
}
|