11 cfg = config.services.infnoise;
16 enable = mkEnableOption "the Infinite Noise TRNG driver";
18 fillDevRandom = mkOption {
20 Whether to run the infnoise driver as a daemon to refill /dev/random.
22 If disabled, you can use the `infnoise` command-line tool to
23 manually obtain randomness.
31 config = mkIf cfg.enable {
32 environment.systemPackages = [ pkgs.infnoise ];
34 services.udev.extraRules = ''
35 SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", SYMLINK+="infnoise", TAG+="systemd", GROUP="dialout", MODE="0664", ENV{SYSTEMD_WANTS}="infnoise.service"
38 systemd.services.infnoise = mkIf cfg.fillDevRandom {
39 description = "Infinite Noise TRNG driver";
41 bindsTo = [ "dev-infnoise.device" ];
42 after = [ "dev-infnoise.device" ];
45 ExecStart = "${pkgs.infnoise}/bin/infnoise --dev-random --debug";
49 SupplementaryGroups = [ "dialout" ];
50 DeviceAllow = [ "/dev/infnoise" ];
51 DevicePolicy = "closed";
52 PrivateNetwork = true;
53 ProtectSystem = "strict";
55 ProtectHostname = true;
56 ProtectKernelLogs = true;
57 ProtectKernelModules = true;
58 ProtectKernelTunables = true; # only reads entropy pool size and watermark
59 RestrictNamespaces = true;
60 RestrictRealtime = true;
61 LockPersonality = true;
62 MemoryDenyWriteExecute = true;