about summary refs log tree commit diff
path: root/machines/x220-gnome
diff options
context:
space:
mode:
Diffstat (limited to 'machines/x220-gnome')
-rw-r--r--machines/x220-gnome/disko.nix72
-rw-r--r--machines/x220-gnome/hardware-configuration.nix22
2 files changed, 73 insertions, 21 deletions
diff --git a/machines/x220-gnome/disko.nix b/machines/x220-gnome/disko.nix
new file mode 100644
index 0000000..ecbd69c
--- /dev/null
+++ b/machines/x220-gnome/disko.nix
@@ -0,0 +1,72 @@
+{
+  device ? throw "Set this to your disk device, e.g. /dev/sda",
+  ...
+}: {
+  disko.devices = {
+    disk.main = {
+      inherit device;
+      type = "disk";
+      content = {
+        type = "gpt";
+        partitions = {
+          boot = {
+            name = "boot";
+            size = "500M";
+            type = "EF02";
+            content = {
+              type = "filesystem";
+              format = "vfat";
+              mountpoint = "/boot";
+            };
+
+          };
+          swap = {
+            size = "13G";
+            content = {
+              type = "swap";
+              resumeDevice = true;
+            };
+          };
+          root = {
+            name = "root";
+            size = "100%";
+            content = {
+              type = "lvm_pv";
+              vg = "root_vg";
+            };
+          };
+        };
+      };
+    };
+    lvm_vg = {
+      root_vg = {
+        type = "lvm_vg";
+        lvs = {
+          root = {
+            size = "100%FREE";
+            content = {
+              type = "btrfs";
+              extraArgs = ["-f"];
+
+              subvolumes = {
+                "/root" = {
+                  mountpoint = "/";
+                };
+
+                "/persist" = {
+                  mountOptions = ["subvol=persist" "noatime"];
+                  mountpoint = "/persist";
+                };
+
+                "/nix" = {
+                  mountOptions = ["subvol=nix" "noatime"];
+                  mountpoint = "/nix";
+                };
+              };
+            };
+          };
+        };
+      };
+    };
+  };
+}
diff --git a/machines/x220-gnome/hardware-configuration.nix b/machines/x220-gnome/hardware-configuration.nix
index 7db32ec..4065509 100644
--- a/machines/x220-gnome/hardware-configuration.nix
+++ b/machines/x220-gnome/hardware-configuration.nix
@@ -6,37 +6,17 @@
 {
   imports =
     [ (modulesPath + "/installer/scan/not-detected.nix")
+      (import ./disko.nix { device = "/dev/sda"; })
     ];
 
   boot.loader.systemd-boot.enable = true;
   boot.loader.efi.canTouchEfiVariables = true;
 
-  boot.initrd.luks.devices."luks-9f3a316a-7177-4122-a4f5-03fbd375d6e1".device = "/dev/disk/by-uuid/9f3a316a-7177-4122-a4f5-03fbd375d6e1";
-  networking.hostName = "nixos"; # Define your hostname.
- 
-
   boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
   boot.initrd.kernelModules = [ ];
   boot.kernelModules = [ "kvm-intel" ];
   boot.extraModulePackages = [ ];
 
-  fileSystems."/" =
-    { device = "/dev/disk/by-uuid/01db2679-e134-4870-b503-a0e616432175";
-      fsType = "ext4";
-    };
-
-  boot.initrd.luks.devices."luks-8a50e0b7-d2a7-4b0c-b092-9194536cae41".device = "/dev/disk/by-uuid/8a50e0b7-d2a7-4b0c-b092-9194536cae41";
-
-  fileSystems."/boot" =
-    { device = "/dev/disk/by-uuid/D259-64AC";
-      fsType = "vfat";
-      options = [ "fmask=0022" "dmask=0022" ];
-    };
-
-  swapDevices =
-    [ { device = "/dev/disk/by-uuid/a7366f52-418f-47a7-bb29-fbd394d559ee"; }
-    ];
-
   # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
   # (the default) this is the recommended approach. When using systemd-networkd it's
   # still possible to use this option, but it's recommended to use it in conjunction