about summary refs log tree commit diff
path: root/configurations/melian
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-05-01 03:36:55 +0300
committerAzat Bahawi <azat@bahawi.net>2024-05-01 03:36:55 +0300
commit9a20404924fda2587ce4f9769f75369799f34643 (patch)
treea953941a22d6c031e67b267e35a11db72bdd25e3 /configurations/melian
parent2024-04-29 (diff)
2024-05-01
Diffstat (limited to 'configurations/melian')
-rw-r--r--configurations/melian/default.nix106
1 files changed, 106 insertions, 0 deletions
diff --git a/configurations/melian/default.nix b/configurations/melian/default.nix
new file mode 100644
index 0000000..0805b4a
--- /dev/null
+++ b/configurations/melian/default.nix
@@ -0,0 +1,106 @@
+{ lib, pkgs, ... }:
+with lib;
+{
+  nixfiles.modules = {
+    wireguard.client.enable = true;
+
+    syncthing.enable = true;
+
+    bluetooth.enable = true;
+
+    throttled.enable = true;
+
+    android.enable = true;
+  };
+
+  hardware.trackpoint = {
+    enable = true;
+    speed = 500;
+    sensitivity = 250;
+  };
+
+  powerManagement =
+    let
+      modprobe = getExe' pkgs.kmod "modprobe";
+    in
+    {
+      enable = true;
+
+      # This fixes an issue with not being able to suspend or wake up from
+      # suspend due to a kernel bug[1] which is still not fixed.
+      #
+      # I guess this can also be fixed differently[2], which does look a lot nicer
+      # but I'm just too lazy.
+      #
+      # [1]: https://bbs.archlinux.org/viewtopic.php?id=270964
+      # [1]: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/522998
+      # [1]: https://bugs.launchpad.net/ubuntu/+source/pm-utils/+bug/562484/comments/3
+      # [1]: https://gist.github.com/ioggstream/8f380d398aef989ac455b93b92d42048
+      # [2]: https://linrunner.de/tlp/settings/runtimepm.html
+      powerDownCommands = "${modprobe} -r xhci_pci";
+      powerUpCommands = "${modprobe} xhci_pci";
+    };
+
+  services = {
+    thinkfan = {
+      enable = true;
+      settings = {
+        sensors = [
+          {
+            hwmon = "/sys/class/hwmon";
+            name = "coretemp";
+            indices = [ 1 ];
+          }
+        ];
+        fans = [ { tpacpi = "/proc/acpi/ibm/fan"; } ];
+        levels = [
+          [
+            "level auto"
+            0
+            50
+          ]
+          [
+            "level disengaged"
+            50
+            32767
+          ] # This could annoy some people but IDGAF.
+        ];
+      };
+    };
+
+    fwupd.enable = true;
+  };
+
+  boot.initrd.luks.devices."root" = {
+    device = "/dev/disk/by-uuid/c1b46f24-eec0-47d2-a142-75ddfd7bb218";
+    allowDiscards = true;
+    bypassWorkqueues = true;
+  };
+
+  fileSystems = {
+    "/" = {
+      device = "/dev/disk/by-uuid/bb8b09dc-cc67-47e5-8280-532b17a9e62a";
+      fsType = "xfs";
+      options = [ "noatime" ];
+    };
+
+    "/boot" = {
+      device = "/dev/disk/by-uuid/1083-C8A0";
+      fsType = "vfat";
+    };
+  };
+
+  # NOTE This makes hibernation pretty much impossible because the partition is
+  # encrypted.
+  swapDevices = [
+    {
+      device = "/swapfile";
+      size = 8 * 1024;
+    }
+  ];
+
+  zramSwap = {
+    enable = true;
+    memoryPercent = 25;
+  };
+}

Consider giving Nix/NixOS a try! <3