summaryrefslogtreecommitdiffstats
path: root/nixos/modules/security
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2019-05-07 14:59:39 -0500
committerGitHub <noreply@github.com>2019-05-07 14:59:39 -0500
commita2bdd63c4f6e7ddca774f2941251e44d42191fe7 (patch)
treeb9233c4cfa8bb05f0ac35f10a59c876afff86bbb /nixos/modules/security
parentaba815d84c75a9cb275ab403735ccb6aba2256f4 (diff)
parentb809071ffbfb58bad5baf7480b08e951bb0c2744 (diff)
Merge pull request #61072 from dtzWill/feature/rngd-debug-flag
rngd: add option to run w/debug flag
Diffstat (limited to 'nixos/modules/security')
-rw-r--r--nixos/modules/security/rngd.nix33
1 files changed, 23 insertions, 10 deletions
diff --git a/nixos/modules/security/rngd.nix b/nixos/modules/security/rngd.nix
index a54ef2e6fcad..60361d9960ed 100644
--- a/nixos/modules/security/rngd.nix
+++ b/nixos/modules/security/rngd.nix
@@ -2,20 +2,30 @@
with lib;
+let
+ cfg = config.security.rngd;
+in
{
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.
- '';
+ 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.
+ '';
+ };
+ debug = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable debug output (-d).";
+ };
};
};
- config = mkIf config.security.rngd.enable {
+ config = mkIf cfg.enable {
services.udev.extraRules = ''
KERNEL=="random", TAG+="systemd"
SUBSYSTEM=="cpu", ENV{MODALIAS}=="cpu:type:x86,*feature:*009E*", TAG+="systemd", ENV{SYSTEMD_WANTS}+="rngd.service"
@@ -29,7 +39,10 @@ with lib;
description = "Hardware RNG Entropy Gatherer Daemon";
- serviceConfig.ExecStart = "${pkgs.rng-tools}/sbin/rngd -f";
+ serviceConfig = {
+ ExecStart = "${pkgs.rng-tools}/sbin/rngd -f"
+ + optionalString cfg.debug " -d";
+ };
};
};
}