From 1ac86e14c746140a7fa9a6e81a3471739655366b Mon Sep 17 00:00:00 2001 From: Daniel Frank Date: Fri, 18 Oct 2019 00:53:48 +0200 Subject: [PATCH] swap: depend on rngd if enabled and randomEncryption is configured to avoid entropy starvation during boot --- nixos/modules/config/swap.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/modules/config/swap.nix b/nixos/modules/config/swap.nix index d0fc0d4a3ea4..adb4e2294213 100644 --- a/nixos/modules/config/swap.nix +++ b/nixos/modules/config/swap.nix @@ -185,6 +185,8 @@ in { description = "Initialisation of swap device ${sw.device}"; wantedBy = [ "${realDevice'}.swap" ]; before = [ "${realDevice'}.swap" ]; + # If swap is encrypted, depending on rngd resolves a possible entropy starvation during boot + after = mkIf (config.security.rngd.enable && sw.randomEncryption.enable) [ "rngd.service" ]; path = [ pkgs.utillinux ] ++ optional sw.randomEncryption.enable pkgs.cryptsetup; script =