From fd3e326e9a75f919463184a53ca2ee9c31e4ebdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 21 Nov 2024 14:11:02 +0100 Subject: [PATCH] disable swap in disko-install Update disko-install Co-authored-by: Michael Hoang --- disko-install | 4 +++- lib/types/swap.nix | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/disko-install b/disko-install index f4a5963..4f0a8b7 100755 --- a/disko-install +++ b/disko-install @@ -240,7 +240,9 @@ main() { exit 0 fi - "$disko_script" + # We don't want swap as can break your running system in weird ways if you eject the disk + # Hopefully disko-install has enough RAM to run without swap, otherwise we can make this configurable in future. + DISKO_SKIP_SWAP=1 "$disko_script" for source in "${!extraFiles[@]}"; do destination=${extraFiles[$source]} diff --git a/lib/types/swap.nix b/lib/types/swap.nix index 401ac12..84e6b03 100644 --- a/lib/types/swap.nix +++ b/lib/types/swap.nix @@ -80,7 +80,7 @@ # TODO: we don't support encrypted swap yet default = lib.optionalAttrs (!config.randomEncryption) { fs.${config.device} = '' - if ! swapon --show | grep -q "^$(readlink -f "${config.device}") "; then + if test "''${DISKO_SKIP_SWAP:-}" != 1 && ! swapon --show | grep -q "^$(readlink -f "${config.device}") "; then swapon ${ lib.optionalString (config.discardPolicy != null) "--discard${lib.optionalString (config.discardPolicy != "both")