about summary refs log tree commit diff
path: root/nixos/modules/config/swap.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/config/swap.nix')
-rw-r--r--nixos/modules/config/swap.nix4
1 files changed, 3 insertions, 1 deletions
diff --git a/nixos/modules/config/swap.nix b/nixos/modules/config/swap.nix
index fed3fa3bc7c8..adb4e2294213 100644
--- a/nixos/modules/config/swap.nix
+++ b/nixos/modules/config/swap.nix
@@ -58,7 +58,7 @@ let
       device = mkOption {
         example = "/dev/sda3";
         type = types.str;
-        description = "Path of the device.";
+        description = "Path of the device or swap file.";
       };
 
       label = mkOption {
@@ -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 =