summary refs log tree commit diff
path: root/nixos/modules/config/swap.nix
diff options
context:
space:
mode:
authorDaniel Frank <git@danielfrank.net>2019-10-18 00:53:48 +0200
committerDaniel Frank <git@danielfrank.net>2020-02-08 12:26:09 +0100
commit1ac86e14c746140a7fa9a6e81a3471739655366b (patch)
tree65961a8b52a0794cac6d51696deb1de7b4fd0138 /nixos/modules/config/swap.nix
parent2de41ccab3e13f7c8b218a6149bb41473ff78fe6 (diff)
downloadnixpkgs-1ac86e14c746140a7fa9a6e81a3471739655366b.tar
nixpkgs-1ac86e14c746140a7fa9a6e81a3471739655366b.tar.gz
nixpkgs-1ac86e14c746140a7fa9a6e81a3471739655366b.tar.bz2
nixpkgs-1ac86e14c746140a7fa9a6e81a3471739655366b.tar.lz
nixpkgs-1ac86e14c746140a7fa9a6e81a3471739655366b.tar.xz
nixpkgs-1ac86e14c746140a7fa9a6e81a3471739655366b.tar.zst
nixpkgs-1ac86e14c746140a7fa9a6e81a3471739655366b.zip
swap: depend on rngd if enabled and randomEncryption is configured to
avoid entropy starvation during boot
Diffstat (limited to 'nixos/modules/config/swap.nix')
-rw-r--r--nixos/modules/config/swap.nix2
1 files changed, 2 insertions, 0 deletions
diff --git a/nixos/modules/config/swap.nix b/nixos/modules/config/swap.nix
index d0fc0d4a3ea..adb4e229421 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 =