mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 08:23:09 +00:00
6afb255d97
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
61 lines
1.7 KiB
Nix
61 lines
1.7 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.infnoise;
|
|
in {
|
|
options = {
|
|
services.infnoise = {
|
|
enable = mkEnableOption "the Infinite Noise TRNG driver";
|
|
|
|
fillDevRandom = mkOption {
|
|
description = ''
|
|
Whether to run the infnoise driver as a daemon to refill /dev/random.
|
|
|
|
If disabled, you can use the `infnoise` command-line tool to
|
|
manually obtain randomness.
|
|
'';
|
|
type = types.bool;
|
|
default = true;
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
environment.systemPackages = [ pkgs.infnoise ];
|
|
|
|
services.udev.extraRules = ''
|
|
SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", SYMLINK+="infnoise", TAG+="systemd", GROUP="dialout", MODE="0664", ENV{SYSTEMD_WANTS}="infnoise.service"
|
|
'';
|
|
|
|
systemd.services.infnoise = mkIf cfg.fillDevRandom {
|
|
description = "Infinite Noise TRNG driver";
|
|
|
|
bindsTo = [ "dev-infnoise.device" ];
|
|
after = [ "dev-infnoise.device" ];
|
|
|
|
serviceConfig = {
|
|
ExecStart = "${pkgs.infnoise}/bin/infnoise --dev-random --debug";
|
|
Restart = "always";
|
|
User = "infnoise";
|
|
DynamicUser = true;
|
|
SupplementaryGroups = [ "dialout" ];
|
|
DeviceAllow = [ "/dev/infnoise" ];
|
|
DevicePolicy = "closed";
|
|
PrivateNetwork = true;
|
|
ProtectSystem = "strict";
|
|
ProtectHome = true;
|
|
ProtectHostname = true;
|
|
ProtectKernelLogs = true;
|
|
ProtectKernelModules = true;
|
|
ProtectKernelTunables = true; # only reads entropy pool size and watermark
|
|
RestrictNamespaces = true;
|
|
RestrictRealtime = true;
|
|
LockPersonality = true;
|
|
MemoryDenyWriteExecute = true;
|
|
};
|
|
};
|
|
};
|
|
}
|