From 435737144be0259559ca3b43f7d72252b1fdcc1b Mon Sep 17 00:00:00 2001 From: Felix Uhl Date: Thu, 22 Aug 2024 18:42:32 +0200 Subject: [PATCH] swap: don't create filesystem if randomEncryption is enabled This is not an issue when initially creating the partition because device mapper will just map on top of the filesystem, but it breaks incremental updates because the check for `TYPE=` will fail, and the subsequent attempt to run `mkswap` also fails: mkswap: cannot open /dev/disk/by-partlabel/disk-nix-store-swap: Device or resource busy Instead, just don't do anything, NixOS will take care of it. --- lib/types/swap.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/types/swap.nix b/lib/types/swap.nix index 0cb4270..ca544b6 100644 --- a/lib/types/swap.nix +++ b/lib/types/swap.nix @@ -60,7 +60,8 @@ }; _create = diskoLib.mkCreateOption { inherit config options; - default = '' + # TODO: we don't support encrypted swap yet + default = lib.optionalString (!config.randomEncryption) '' if ! blkid "${config.device}" -o export | grep -q '^TYPE='; then mkswap \ ${toString config.extraArgs} \