@@ -324,10 +324,19 @@ my @swapDevices;
324324if (@swaps) {
325325 shift @swaps;
326326 foreach my $swap (@swaps) {
327− $swap =~ /^(\S+)\s/;
328− next unless -e $1;
329− my $dev = findStableDevPath $1;
330− push @swapDevices, "{ device = \"$dev\"; }";
327+ my @fields = split ' ', $swap;
328+ my $swapFilename = $fields[0];
329+ my $swapType = $fields[1];
330+ next unless -e $swapFilename;
331+ my $dev = findStableDevPath $swapFilename;
332+ if ($swapType =~ "partition") {
333+ push @swapDevices, "{ device = \"$dev\"; }";
334+ } elsif ($swapType =~ "file") {
335+ # swap *files* are more likely specified in configuration.nix, so
336+ # ignore them here.
337+ } else {
338+ die "Unsupported swap type: $swapType\n";
339+ }
331340 }
332341}
333342