Attempt to support both UEFI and BIOS

This commit is contained in:
Sravan Balaji
2024-03-24 15:42:47 -04:00
parent 6c06028e80
commit 8722b995cc
2 changed files with 15 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
let let
installDisk = "sda"; installDisk = "sda";
bootPartitionSize = "512M"; bootPartitionSize = "512M";
swapfileSize = "34G"; swapfileSize = "10G";
in { in {
disko.devices = { disko.devices = {
disk = { disk = {
@@ -11,6 +11,10 @@ in {
content = { content = {
type = "gpt"; type = "gpt";
partitions = { partitions = {
boot = {
size = "1M";
type = "EF02"; # for grub MBR
};
ESP = { ESP = {
size = bootPartitionSize; size = bootPartitionSize;
type = "EF00"; type = "EF00";
@@ -27,31 +31,30 @@ in {
size = "100%"; size = "100%";
content = { content = {
type = "luks"; type = "luks";
name = "crypted"; name = "cryptroot";
settings.allowDiscards = true; settings.allowDiscards = true;
# passwordFile = "/tmp/secret.key"; # Interactive
content = { content = {
type = "btrfs"; type = "btrfs";
extraArgs = [ "-f" ]; extraArgs = [ "-f" ];
subvolumes = { subvolumes = {
"/root" = { "@" = {
mountpoint = "/"; mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" "discard=async" "space_cache=v2" "ssd" ]; mountOptions = [ "compress=zstd" "noatime" "discard=async" "space_cache=v2" "ssd" ];
}; };
"/home" = { "@home" = {
mountpoint = "/home"; mountpoint = "/home";
mountOptions = [ "compress=zstd" "noatime" "discard=async" "space_cache=v2" "ssd" ]; mountOptions = [ "compress=zstd" "noatime" "discard=async" "space_cache=v2" "ssd" ];
}; };
"/.snapshots" = { "@.snapshots" = {
mountpoint = "/.snapshots"; mountpoint = "/.snapshots";
mountOptions = [ "compress=zstd" "noatime" "discard=async" "space_cache=v2" "ssd" ]; mountOptions = [ "compress=zstd" "noatime" "discard=async" "space_cache=v2" "ssd" ];
}; };
"/nix" = { "@nix" = {
mountpoint = "/nix"; mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" "discard=async" "space_cache=v2" "ssd" ]; mountOptions = [ "compress=zstd" "noatime" "discard=async" "space_cache=v2" "ssd" ];
}; };
"/swap" = { "@swap" = {
mountpoint = "/.swapvol"; mountpoint = "/swap";
swap.swapfile.size = swapfileSize; swap.swapfile.size = swapfileSize;
}; };
}; };

View File

@@ -32,16 +32,14 @@
boot = { boot = {
initrd.enable = true; initrd.enable = true;
loader = { loader = {
efi = { systemd-boot.enable = false;
canTouchEfiVariables = true; efi.canTouchEfiVariables = false;
efiSysMountPoint = "/boot";
};
grub = { grub = {
enable = true; enable = true;
device = "nodev";
efiSupport = true; efiSupport = true;
enableCryptodisk = true; enableCryptodisk = true;
useOSProber = true; useOSProber = true;
efiInstallAsRemovable = true;
}; };
}; };
}; };