Skip to content

Commit

Permalink
swap: don't create filesystem if randomEncryption is enabled
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
iFreilicht authored and mergify[bot] committed Aug 22, 2024
1 parent f6b2e00 commit 4357371
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/types/swap.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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} \
Expand Down

0 comments on commit 4357371

Please sign in to comment.