swap: depend on rngd if enabled and randomEncryption is configured to

avoid entropy starvation during boot
This commit is contained in:
Daniel Frank 2019-10-18 00:53:48 +02:00
parent 2de41ccab3
commit 1ac86e14c7
No known key found for this signature in database
GPG Key ID: 063CCCAD04182D32

View File

@ -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 =