diff --git a/nixos/modules/config/swap.nix b/nixos/modules/config/swap.nix index 496ccb21e7c6..fa09b61ddec0 100644 --- a/nixos/modules/config/swap.nix +++ b/nixos/modules/config/swap.nix @@ -297,7 +297,7 @@ in ${lib.optionalString (sw.size != null) '' currentSize=$(( $(stat -c "%s" "$DEVICE" 2>/dev/null || echo 0) / 1024 / 1024 )) if [[ ! -b "$DEVICE" && "${toString sw.size}" != "$currentSize" ]]; then - if [[ $(stat -f -c %T "$(dirname "$DEVICE")") == "btrfs" ]]; then + if [[ "$(stat -f -c %T "$(dirname "$DEVICE")")" == "btrfs" ]]; then # Use btrfs mkswapfile to speed up the creation of swapfile. rm -f "$DEVICE" btrfs filesystem mkswapfile --size "${toString sw.size}M" --uuid clear "$DEVICE" @@ -331,6 +331,7 @@ in mkswap ${sw.realDevice} ''} ''; + enableStrictShellChecks = true; unitConfig.RequiresMountsFor = [ "${dirOf sw.device}" ]; unitConfig.DefaultDependencies = false; # needed to prevent a cycle