diff --git a/hosts/prophet/default.nix b/hosts/prophet/default.nix index d1650d3..c718648 100644 --- a/hosts/prophet/default.nix +++ b/hosts/prophet/default.nix @@ -2,6 +2,7 @@ { imports = [ ./boot + ./disko ./filesystems ./hardware ./users diff --git a/hosts/prophet/disko/default.nix b/hosts/prophet/disko/default.nix new file mode 100644 index 0000000..c90b72d --- /dev/null +++ b/hosts/prophet/disko/default.nix @@ -0,0 +1,84 @@ +{ config, disko, ... }: +{ + imports = [ disko.nixosModules.disko ]; + + disko.devices = { + disk = { + "${config.networking.hostName}" = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + ESP = { + priority = 1; + size = "2G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + main = { + size = "100%"; + content = { + type = "lvm_pv"; + vg = "${config.networking.hostName}"; + }; + }; + }; + }; + }; + }; + + lvm_vg = { + "${config.networking.hostName}" = { + type = "lvm_vg"; + lvs = { + root = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "/root" = { + mountpoint = "/"; + mountOptions = [ "compress=zstd" "noatime" "ssd" ]; + }; + "/prev" = { + mountpoint = "/prev"; + mountOptions = [ "compress=zstd" "noatime" "ssd" "noexec" ]; + }; + "/nix" = { + mountpoint = "/nix"; + mountOptions = [ "compress=zstd" "noatime" "ssd" ]; + }; + + # Impermanence + "/persist" = { + mountpoint = "/persist"; + mountOptions = [ "compress=zstd" "noatime" "ssd" ]; + }; + "/persist/.snapshots" = { }; + "/persist/home/${config.sysusers.main}" = { }; + "/persist/home/${config.sysusers.main}/.snapshots" = { }; + }; + }; + }; + swap = { + size = "2G"; + content = { + type = "swap"; + discardPolicy = "both"; + }; + }; + }; + }; + }; + }; + + # Needed for impermanence + fileSystems."/persist".neededForBoot = true; +} diff --git a/hosts/prophet/filesystems/default.nix b/hosts/prophet/filesystems/default.nix index 8056766..ecf65f0 100644 --- a/hosts/prophet/filesystems/default.nix +++ b/hosts/prophet/filesystems/default.nix @@ -1,42 +1,11 @@ { ... }: { fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/e50e186d-e5bc-40b0-9cd7-43b609cde3ea"; - fsType = "btrfs"; - options = [ "subvol=root" ]; - }; - "/prev" = { - device = "/dev/disk/by-uuid/e50e186d-e5bc-40b0-9cd7-43b609cde3ea"; - fsType = "btrfs"; - options = [ "subvol=prev" ]; - }; - "/nix" = { - device = "/dev/disk/by-uuid/e50e186d-e5bc-40b0-9cd7-43b609cde3ea"; - fsType = "btrfs"; - options = [ "subvol=nix" ]; - }; - "/boot" = { - device = "/dev/disk/by-uuid/7C94-8C9A"; - fsType = "vfat"; - options = [ "umask=0077" ]; - }; - - # Impermanence and subvols - "/persist" = { - device = "/dev/disk/by-uuid/e50e186d-e5bc-40b0-9cd7-43b609cde3ea"; - fsType = "btrfs"; - neededForBoot = true; - options = [ "subvol=persist" ]; - }; + # Misc bulk storage "/export/Bulk" = { device = "/dev/disk/by-uuid/ef465845-cc56-4db5-9260-8ae515eb025e"; fsType = "btrfs"; noCheck = true; }; }; - - swapDevices = [ - { device = "/dev/disk/by-uuid/7e8c773d-c8f4-4dd8-a835-bde78e5b6760"; } - ]; }