From 75f53fafee195003fcc4a8aef885dfc378ebdc66 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Mon, 23 Sep 2024 23:59:07 -0400 Subject: [PATCH] reuse disko configs where possible --- .../disko.nix => disko/btrfs-subvolumes.nix | 4 +- .../luks-btrfs-subvolumes.nix | 4 +- hosts/lavaridge/default.nix | 2 +- hosts/petalburg/default.nix | 2 +- hosts/petalburg/disko.nix | 56 ------------------- hosts/rustboro/default.nix | 2 +- hosts/rustboro/disko.nix | 56 ------------------- hosts/slateport/default.nix | 4 +- 8 files changed, 9 insertions(+), 121 deletions(-) rename hosts/slateport/disko.nix => disko/btrfs-subvolumes.nix (95%) rename hosts/lavaridge/disko.nix => disko/luks-btrfs-subvolumes.nix (95%) delete mode 100644 hosts/petalburg/disko.nix delete mode 100644 hosts/rustboro/disko.nix diff --git a/hosts/slateport/disko.nix b/disko/btrfs-subvolumes.nix similarity index 95% rename from hosts/slateport/disko.nix rename to disko/btrfs-subvolumes.nix index 49a32b36..9d2c4ec4 100644 --- a/hosts/slateport/disko.nix +++ b/disko/btrfs-subvolumes.nix @@ -1,9 +1,9 @@ -{ +{disks ? ["/dev/nvme0n1"], ...}: { disko.devices = { disk = { main = { type = "disk"; - device = "/dev/sda"; + device = builtins.elemAt disks 0; content = { type = "gpt"; diff --git a/hosts/lavaridge/disko.nix b/disko/luks-btrfs-subvolumes.nix similarity index 95% rename from hosts/lavaridge/disko.nix rename to disko/luks-btrfs-subvolumes.nix index a6a16273..98f83558 100644 --- a/hosts/lavaridge/disko.nix +++ b/disko/luks-btrfs-subvolumes.nix @@ -1,9 +1,9 @@ -{ +{disks ? ["/dev/nvme0n1"], ...}: { disko.devices = { disk = { vdb = { type = "disk"; - device = "/dev/nvme0n1"; + device = builtins.elemAt disks 0; content = { type = "gpt"; partitions = { diff --git a/hosts/lavaridge/default.nix b/hosts/lavaridge/default.nix index a5d644a4..78349f6e 100644 --- a/hosts/lavaridge/default.nix +++ b/hosts/lavaridge/default.nix @@ -6,10 +6,10 @@ ... }: { imports = [ - ./disko.nix ./home.nix ./secrets.nix ./stylix.nix + (import ./../../disko/luks-btrfs-subvolumes.nix {disks = ["/dev/nvme0n1"];}) self.inputs.nixhw.nixosModules.framework-13-amd-7000 self.nixosModules.common-auto-upgrade self.nixosModules.common-base diff --git a/hosts/petalburg/default.nix b/hosts/petalburg/default.nix index f18742aa..2f7c38b9 100644 --- a/hosts/petalburg/default.nix +++ b/hosts/petalburg/default.nix @@ -6,10 +6,10 @@ ... }: { imports = [ - ./disko.nix ./home.nix ./secrets.nix ./stylix.nix + (import ./../../disko/luks-btrfs-subvolumes.nix {disks = ["/dev/nvme0n1"];}) self.inputs.nixhw.nixosModules.lenovo-yoga-9i-intel-13th self.nixosModules.common-auto-upgrade self.nixosModules.common-base diff --git a/hosts/petalburg/disko.nix b/hosts/petalburg/disko.nix deleted file mode 100644 index a6a16273..00000000 --- a/hosts/petalburg/disko.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ - disko.devices = { - disk = { - vdb = { - type = "disk"; - device = "/dev/nvme0n1"; - content = { - type = "gpt"; - partitions = { - ESP = { - size = "1024M"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ - "defaults" - ]; - }; - }; - luks = { - size = "100%"; - content = { - type = "luks"; - name = "crypted"; - content = { - type = "btrfs"; - extraArgs = ["-f"]; - subvolumes = { - "/root" = { - mountpoint = "/"; - mountOptions = ["compress=zstd" "noatime"]; - }; - "persist" = { - mountpoint = "/persist"; - mountOptions = ["compress=zstd" "noatime"]; - }; - "/home" = { - mountpoint = "/home"; - mountOptions = ["compress=zstd" "noatime"]; - }; - "/nix" = { - mountpoint = "/nix"; - mountOptions = ["compress=zstd" "noatime"]; - }; - }; - }; - }; - }; - }; - }; - }; - }; - }; -} diff --git a/hosts/rustboro/default.nix b/hosts/rustboro/default.nix index 5f2268ea..01f9ff26 100644 --- a/hosts/rustboro/default.nix +++ b/hosts/rustboro/default.nix @@ -6,10 +6,10 @@ ... }: { imports = [ - ./disko.nix ./home.nix ./secrets.nix ./stylix.nix + (import ./../../disko/luks-btrfs-subvolumes.nix {disks = ["/dev/sda"];}) self.inputs.nixhw.nixosModules.thinkpad-t440p self.nixosModules.common-auto-upgrade self.nixosModules.common-base diff --git a/hosts/rustboro/disko.nix b/hosts/rustboro/disko.nix deleted file mode 100644 index 66b9e72f..00000000 --- a/hosts/rustboro/disko.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ - disko.devices = { - disk = { - vdb = { - type = "disk"; - device = "/dev/sda"; - content = { - type = "gpt"; - partitions = { - ESP = { - size = "1024M"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ - "defaults" - ]; - }; - }; - luks = { - size = "100%"; - content = { - type = "luks"; - name = "crypted"; - content = { - type = "btrfs"; - extraArgs = ["-f"]; - subvolumes = { - "/root" = { - mountpoint = "/"; - mountOptions = ["compress=zstd" "noatime"]; - }; - "persist" = { - mountpoint = "/persist"; - mountOptions = ["compress=zstd" "noatime"]; - }; - "/home" = { - mountpoint = "/home"; - mountOptions = ["compress=zstd" "noatime"]; - }; - "/nix" = { - mountpoint = "/nix"; - mountOptions = ["compress=zstd" "noatime"]; - }; - }; - }; - }; - }; - }; - }; - }; - }; - }; -} diff --git a/hosts/slateport/default.nix b/hosts/slateport/default.nix index a8b4d041..403be865 100644 --- a/hosts/slateport/default.nix +++ b/hosts/slateport/default.nix @@ -4,13 +4,13 @@ ... }: { imports = [ - ./disko.nix ./home.nix ./raffauflabs.nix ./secrets.nix + (import ./../../disko/btrfs-subvolumes.nix {disks = ["/dev/sda"];}) + self.inputs.nixhw.nixosModules.common-bluetooth self.inputs.nixhw.nixosModules.common-intel-cpu self.inputs.nixhw.nixosModules.common-intel-gpu - self.inputs.nixhw.nixosModules.common-bluetooth self.inputs.nixhw.nixosModules.common-ssd self.nixosModules.common-auto-upgrade self.nixosModules.common-base