about summary refs log tree commit diff
path: root/nix/hardware-configuration.nix
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2021-11-07 13:47:02 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2021-11-07 20:17:10 +0700
commit557705fc88fc0405d8f79bb15cbf0679e168cf6c (patch)
tree69dcb97176f0e6d1b26554963239dca33a41f75b /nix/hardware-configuration.nix
parentb078705298d983396fff6b673f3b7f93c5bac471 (diff)
downloaddotfiles-557705fc88fc0405d8f79bb15cbf0679e168cf6c.tar.gz
Migrate NixOS to tmpfs+btrfs
Diffstat (limited to 'nix/hardware-configuration.nix')
-rw-r--r--nix/hardware-configuration.nix65
1 files changed, 47 insertions, 18 deletions
diff --git a/nix/hardware-configuration.nix b/nix/hardware-configuration.nix
index 4ed5ba4..63c0801 100644
--- a/nix/hardware-configuration.nix
+++ b/nix/hardware-configuration.nix
@@ -6,38 +6,67 @@
 {
   imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
 
-  boot.initrd.availableKernelModules = [
-    "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"
-  ];
-  boot.initrd.kernelModules = [ ];
-  boot.kernelModules = [ "kvm-intel" ];
-  boot.extraModulePackages = [ ];
+  boot = {
+    initrd = {
+      availableKernelModules = [
+        "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage"
+        "sd_mod" "rtsx_pci_sdmmc"
+      ];
+      kernelModules = [ ];
+    };
+    kernelModules = [ "kvm-intel" ];
+    extraModulePackages = [ ];
+  };
 
+  nix.readOnlyStore = false;
   fileSystems = {
     "/" = {
-      device = "/dev/disk/by-uuid/34058769-4280-4374-ad92-259554380a9e";
-      fsType = "ext4";
+      device = "none";
+      fsType = "tmpfs";
     };
 
     "/boot" = {
-      device = "/dev/disk/by-uuid/8EB8-6EDD";
+      device = "/dev/disk/by-uuid/B283-B76E";
       fsType = "vfat";
     };
 
+    "/nix" = {
+      device = "/dev/disk/by-uuid/c334d115-eda9-4470-8c28-b01c4628865b";
+      fsType = "btrfs";
+      options = [ "subvol=nix" "compress=zstd" "noatime" ];
+    };
+
+    "/etc" = {
+      device = "/dev/disk/by-uuid/c334d115-eda9-4470-8c28-b01c4628865b";
+      fsType = "btrfs";
+      options = [ "subvol=etc" "compress=zstd" "noatime" ];
+    };
+
+    "/root" = {
+      device = "/dev/disk/by-uuid/c334d115-eda9-4470-8c28-b01c4628865b";
+      fsType = "btrfs";
+      options = [ "subvol=root" "compress=zstd" "noatime" ];
+    };
+
     "/home" = {
-      device = "/dev/disk/by-uuid/69991f9d-8fec-4b32-8e3e-83d6a2c64257";
-      fsType = "ext4";
+      device = "/dev/disk/by-uuid/c334d115-eda9-4470-8c28-b01c4628865b";
+      fsType = "btrfs";
+      options = [ "subvol=home" "compress=zstd" ];
     };
 
-    # "/data" = {
-    #   device = "/dev/disk/by-uuid/02594f2b-d681-49fc-8f4a-0616d44c8987";
-    #   fsType = "ext4";
-    # };
+    "/var/log" = {
+      device = "/dev/disk/by-uuid/c334d115-eda9-4470-8c28-b01c4628865b";
+      fsType = "btrfs";
+      options = [ "subvol=log" "compress=zstd" ];
+      neededForBoot = true;
+    };
   };
 
-  # swapDevices = [
-  #   { device = "/dev/disk/by-uuid/6f45a147-3b44-4eb9-8ac3-2201e80cff5e"; }
-  # ];
+  services.fstrim.enable = true;
+
+  swapDevices = [
+    { device = "/dev/disk/by-uuid/d3a6d2bc-19dd-4260-a6d4-89c04264dbd8"; }
+  ];
 
   powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
 }