From 557705fc88fc0405d8f79bb15cbf0679e168cf6c Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Sun, 7 Nov 2021 13:47:02 +0700 Subject: Migrate NixOS to tmpfs+btrfs --- nix/hardware-configuration.nix | 65 ++++++++++++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 18 deletions(-) (limited to 'nix/hardware-configuration.nix') 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"; } -- cgit 1.4.1