mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-19 20:21:14 +00:00
deacd0bd73
TPM1.2 support has been dropped in rng-tools v6.5
see caef8cce97
rngd won't access /dev/tpm0 anymore and the "--no-tpm=1" option is now unrecognised
36 lines
927 B
Nix
36 lines
927 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
{
|
|
options = {
|
|
security.rngd.enable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = ''
|
|
Whether to enable the rng daemon, which adds entropy from
|
|
hardware sources of randomness to the kernel entropy pool when
|
|
available.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = mkIf config.security.rngd.enable {
|
|
services.udev.extraRules = ''
|
|
KERNEL=="random", TAG+="systemd"
|
|
SUBSYSTEM=="cpu", ENV{MODALIAS}=="cpu:type:x86,*feature:*009E*", TAG+="systemd", ENV{SYSTEMD_WANTS}+="rngd.service"
|
|
KERNEL=="hw_random", TAG+="systemd", ENV{SYSTEMD_WANTS}+="rngd.service"
|
|
'';
|
|
|
|
systemd.services.rngd = {
|
|
bindsTo = [ "dev-random.device" ];
|
|
|
|
after = [ "dev-random.device" ];
|
|
|
|
description = "Hardware RNG Entropy Gatherer Daemon";
|
|
|
|
serviceConfig.ExecStart = "${pkgs.rng-tools}/sbin/rngd -f -v";
|
|
};
|
|
};
|
|
}
|