diff options
Diffstat (limited to 'profiles/disk/btrfs-on-luks.nix')
| -rw-r--r-- | profiles/disk/btrfs-on-luks.nix | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/profiles/disk/btrfs-on-luks.nix b/profiles/disk/btrfs-on-luks.nix new file mode 100644 index 0000000..3fe57f7 --- /dev/null +++ b/profiles/disk/btrfs-on-luks.nix @@ -0,0 +1,74 @@ +{ ... }: +let + btrfsopt = [ + "compress=zstd" + "noatime" + ]; +in +{ + services.btrfs.autoScrub.enable = true; + services.btrfs.autoScrub.fileSystems = [ + "/nix" + "/data" + ]; + + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "2G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ + "fmask=0022" + "dmask=0022" + ]; + }; + }; + luks = { + size = "100%"; + content = { + type = "luks"; + name = "nixos"; + passwordFile = "/tmp/pass"; + settings = { + allowDiscards = true; + }; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "@root" = { + mountpoint = "/"; + mountOptions = btrfsopt; + }; + "@home" = { + mountpoint = "/home"; + mountOptions = btrfsopt; + }; + "@nix" = { + mountpoint = "/nix"; + mountOptions = btrfsopt; + }; + "@data" = { + mountpoint = "/data"; + mountOptions = btrfsopt; + }; + }; + }; + }; + }; + }; + }; + }; + }; + }; +} |
