mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-12 15:47:28 +00:00
29027fd1e1
Using pkgs.lib on the spine of module evaluation is problematic because the pkgs argument depends on the result of module evaluation. To prevent an infinite recursion, pkgs and some of the modules are evaluated twice, which is inefficient. Using ‘with lib’ prevents this problem.
45 lines
923 B
Nix
45 lines
923 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
{
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
services.klogd.enable = mkOption {
|
|
type = types.bool;
|
|
default = versionOlder (getVersion config.boot.kernelPackages.kernel) "3.5";
|
|
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.
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
|
|
###### implementation
|
|
|
|
config = mkIf config.services.klogd.enable {
|
|
|
|
jobs.klogd =
|
|
{ description = "Kernel Log Daemon";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
path = [ pkgs.sysklogd ];
|
|
|
|
unitConfig.ConditionVirtualization = "!systemd-nspawn";
|
|
|
|
exec =
|
|
"klogd -c 1 -2 -n " +
|
|
"-k $(dirname $(readlink -f /run/booted-system/kernel))/System.map";
|
|
};
|
|
|
|
};
|
|
|
|
}
|