Full Disk Encryption: Difference between revisions

imported>Zimbatm
m fix formatting
imported>Zimbatm
No edit summary
Line 90: Line 90:
</syntaxhighlight>
</syntaxhighlight>


Create a swapfile of the size you want
Now keep installing as usual, nixos-generate-config should detect the right partitioning. You should have something like this in your /etc/nixos/hardware-configuration.nix:
<syntaxhighlight lang="bash">
 
$ fallocate -l 512M /mnt/swapfile
<syntaxhighlight lang="nix">
$ chmod 600 /mnt/swapfile
{ # cut
$ mkswap -L swap /mnt/swapfile
  fileSystems."/" =
$ swapon /mnt/swapfile
    { device = "/dev/disk/by-uuid/5e7458b3-dcd2-49c6-a330-e2c779e99b66";
      fsType = "ext4";
    };
 
  boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/d2cb12f8-67e3-4725-86c3-0b5c7ebee3a6";
 
  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/863B-7B32";
      fsType = "vfat";
    };
 
  swapDevices = [ ];
}
</syntaxhighlight>
</syntaxhighlight>


Now keep installing as usual, nixos-generate-config should detect the right partitioning (maybe not the swap file).
To create a swap add the following in your /etc/nixos/configuration.nix:
<syntaxhighlight lang="nix">
{
  swapDevices = [{device = "/swapfile"; size = 10000;}];
}
</syntaxhighlight>