about summary refs log tree commit diff
path: root/machines
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2024-10-05 23:23:00 +0200
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2024-10-05 23:23:00 +0200
commit39ebafe4abb271884e180fbd1b35c0705bae9b88 (patch)
treee65c0bbeda626ab70ffab866c784aeeb149e5873 /machines
parent91432241065a8881bd1bc67c98d00618b85a05f5 (diff)
downloaddots-39ebafe4abb271884e180fbd1b35c0705bae9b88.tar.gz
dots-39ebafe4abb271884e180fbd1b35c0705bae9b88.zip
Working boot on x220
Diffstat (limited to 'machines')
-rw-r--r--machines/x220-gnome/disko.nix72
-rw-r--r--machines/x220-gnome/hardware-configuration.nix22
-rw-r--r--machines/x220/default.nix62
-rw-r--r--machines/x220/disko.nix12
4 files changed, 109 insertions, 59 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
diff --git a/machines/x220/default.nix b/machines/x220/default.nix
index a4914ca..4fac58f 100644
--- a/machines/x220/default.nix
+++ b/machines/x220/default.nix
@@ -48,37 +48,37 @@
 	];
 
 	fileSystems."/persist".neededForBoot = true;
-	environment.persistence."/persistent" = {
-    enable = true;  # NB: Defaults to true, not needed
-    hideMounts = true;
-    directories = [
-      "/var/log"
-      "/var/lib/bluetooth"
-      "/var/lib/nixos"
-      "/var/lib/systemd/coredump"
-      "/etc/NetworkManager/system-connections"
-      { directory = "/var/lib/colord"; user = "colord"; group = "colord"; mode = "u=rwx,g=rx,o="; }
-    ];
-    files = [
-      "/etc/machine-id"
-	"/etc/shadow"
-      { file = "/var/keys/secret_file"; parentDirectory = { mode = "u=rwx,g=,o="; }; }
-    ];
-    users.pn = {
-      directories = [
-        "Downloads"
-        "Music"
-        "Pictures"
-        "Documents"
-        "Videos"
-        "VirtualBox VMs"
-        { directory = ".gnupg"; mode = "0700"; }
-        { directory = ".ssh"; mode = "0700"; }
-        { directory = ".local/share/keyrings"; mode = "0700"; }
-        ".local/share/direnv"
-      ];
-    };
-  };
+	#environment.persistence."/persistent" = {
+    #enable = true;  # NB: Defaults to true, not needed
+    #hideMounts = true;
+    #directories = [
+      #"/var/log"
+      #"/var/lib/bluetooth"
+      #"/var/lib/nixos"
+      #"/var/lib/systemd/coredump"
+      #"/etc/NetworkManager/system-connections"
+      #{ directory = "/var/lib/colord"; user = "colord"; group = "colord"; mode = "u=rwx,g=rx,o="; }
+    #];
+    #files = [
+      #"/etc/machine-id"
+	#"/etc/shadow"
+      #{ file = "/var/keys/secret_file"; parentDirectory = { mode = "u=rwx,g=,o="; }; }
+    #];
+    #users.pn = {
+      #directories = [
+        #"Downloads"
+        #"Music"
+        #"Pictures"
+        #"Documents"
+        #"Videos"
+        #"VirtualBox VMs"
+        #{ directory = ".gnupg"; mode = "0700"; }
+        #{ directory = ".ssh"; mode = "0700"; }
+        #{ directory = ".local/share/keyrings"; mode = "0700"; }
+        #".local/share/direnv"
+      #];
+    #};
+  #};
 
 # Some programs need SUID wrappers, can be configured further or are
 # started in user sessions.
diff --git a/machines/x220/disko.nix b/machines/x220/disko.nix
index 714cafa..c8f4ae4 100644
--- a/machines/x220/disko.nix
+++ b/machines/x220/disko.nix
@@ -9,19 +9,17 @@
       content = {
         type = "gpt";
         partitions = {
-          boot = {
-            name = "boot";
-            size = "1M";
-            type = "EF02";
-          };
-          esp = {
+          ESP = {
+            priority = 1;
             name = "ESP";
-            size = "500M";
+            start = "1M";
+            end = "256M";
             type = "EF00";
             content = {
               type = "filesystem";
               format = "vfat";
               mountpoint = "/boot";
+              mountOptions = [ "umask=0077" ];
             };
           };
           swap = {