about summary refs log tree commit diff
path: root/nixos/alpha
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2022-01-26 22:35:48 +0900
committersefidel <contact@sefidel.net>2022-01-26 22:40:42 +0900
commite9ca070fbaaac5b4114d384081e0722ab1025260 (patch)
treef67e52b8244c002a5925957cd7a2feed4e3068a4 /nixos/alpha
parentf1e005ac85d36002fa240340a07d418b86cb377b (diff)
downloadnixrc-e9ca070fbaaac5b4114d384081e0722ab1025260.tar.gz
nixrc-e9ca070fbaaac5b4114d384081e0722ab1025260.zip
nixos/alpha: zfs
Diffstat (limited to 'nixos/alpha')
-rw-r--r--nixos/alpha/configuration.nix13
-rw-r--r--nixos/alpha/hardware-configuration.nix70
2 files changed, 59 insertions, 24 deletions
diff --git a/nixos/alpha/configuration.nix b/nixos/alpha/configuration.nix
index c42fef6..4151ef0 100644
--- a/nixos/alpha/configuration.nix
+++ b/nixos/alpha/configuration.nix
@@ -12,10 +12,16 @@
 
   boot.kernelPackages = pkgs.linuxPackages_xanmod;
   boot.kernelParams = [
+    "nohibernate"
     "nmi_watchdog=0"
     "systemd.watchdog-device/dev/watchdog"
   ];
 
+  boot.initrd.supportedFilesystems = [ "zfs" ];
+  boot.supportedFilesystems = [ "zfs" ];
+  boot.zfs.devNodes = "/dev/";
+  boot.zfs.enableUnstable = true;
+
   # GRUB bootloader
   boot.loader.efi.canTouchEfiVariables = true;
   boot.loader.grub = {
@@ -26,6 +32,7 @@
     configurationLimit = 10;
     device = "nodev";
     useOSProber = true;
+    copyKernels = true;
     extraEntries = ''
       menuentry "Reboot" {
         reboot
@@ -37,6 +44,8 @@
   };
 
   networking.hostName = "alpha";
+  networking.hostId = "641a7b10";
+
   networking.networkmanager.enable = true;
   networking.useDHCP = false;
   networking.firewall.enable = true;
@@ -68,6 +77,10 @@
 
   environment.systemPackages = with pkgs; [ gcc ];
 
+  services.zfs.trim.enable = true;
+  services.zfs.autoScrub.enable = true;
+  services.zfs.autoScrub.pools = [ "rpool" ];
+
   services.openssh.enable = true;
   services.openssh.passwordAuthentication = false;
 
diff --git a/nixos/alpha/hardware-configuration.nix b/nixos/alpha/hardware-configuration.nix
index 3e99ea9..51e30a7 100644
--- a/nixos/alpha/hardware-configuration.nix
+++ b/nixos/alpha/hardware-configuration.nix
@@ -1,17 +1,5 @@
 { config, lib, pkgs, ... }:
 
-let
-  espDev = "/dev/disk/by-uuid/7905-2E41";
-  btrfsDev = "/dev/disk/by-uuid/dc47a0a6-3c73-45c1-951c-40032e762180";
-  swapDev = "/dev/disk/by-uuid/4a74b247-99e9-42c7-9a86-75aea964bb85";
-  dataDev = "/dev/disk/by-uuid/fe7a00a8-0a3c-48de-9d7a-ed7cf172f501";
-
-  subvolume = name: {
-    device = btrfsDev;
-    fsType = "btrfs";
-    options = [ "subvol=${name}" "compress=zstd" "noatime" ];
-  };
-in
 {
   boot.initrd.availableKernelModules = [ "xhci-pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
   boot.initrd.kernelModules = [ ];
@@ -21,28 +9,62 @@ in
   hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
   hardware.enableRedistributableFirmware = true;
 
-  fileSystems."/" = subvolume "root";
-  fileSystems."/home" = subvolume "home";
-  fileSystems."/nix" = subvolume "nix";
-  fileSystems."/persist" = subvolume "persist";
-  fileSystems."/var/log" = {
-    device = btrfsDev;
-    fsType = "btrfs";
-    options = [ "subvol=log" "compress=zstd" "noatime" ];
-    neededForBoot = true;
+  fileSystems."/" = {
+    device = "rpool/root/nixos";
+    fsType = "zfs";
   };
 
   fileSystems."/boot" = {
-    device = espDev;
+    device = "/dev/disk/by-uuid/55B4-0E38";
     fsType = "vfat";
   };
 
+  fileSystems."/nix" = {
+    device = "rpool/root/nixos/nix";
+    fsType = "zfs";
+  };
+
+  fileSystems."/etc" = {
+    device = "rpool/root/nixos/etc";
+    fsType = "zfs";
+  };
+
+  fileSystems."/var" = {
+    device = "rpool/root/nixos/var";
+    fsType = "zfs";
+  };
+
+  fileSystems."/var/lib" = {
+    device = "rpool/root/nixos/var/lib";
+    fsType = "zfs";
+  };
+
+  fileSystems."/var/log" = {
+    device = "rpool/root/nixos/var/log";
+    fsType = "zfs";
+  };
+
+  fileSystems."/var/spool" = {
+    device = "rpool/root/nixos/var/spool";
+    fsType = "zfs";
+  };
+
+  fileSystems."/home" = {
+    device = "rpool/home";
+    fsType = "zfs";
+  };
+
+  fileSystems."/home/boopy" = {
+    device = "rpool/home/boopy";
+    fsType = "zfs";
+  };
+
   fileSystems."/data" = {
-    device = dataDev;
+    device = "/dev/disk/by-uuid/fe7a00a8-0a3c-48de-9d7a-ed7cf172f501";
     fsType = "ext4";
   };
 
-  swapDevices = [{ device = swapDev; }];
+  swapDevices = [ ];
 
   nix.maxJobs = lib.mkDefault 4;
   powerManagement.cpuFreqGovernor = lib.mkDefault "schedutil";