about summary refs log tree commit diff stats
path: root/modules/system
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-07-05 16:25:36 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-07-05 19:43:07 +0200
commitfd9ed4e5e826674131f4887853150d3795dd222f (patch)
tree17998feba0df8ff1ab2f2c4a8bcac270a37ceda6 /modules/system
parentbuild(treewide): Update (diff)
downloadnixos-config-fd9ed4e5e826674131f4887853150d3795dd222f.tar.gz
nixos-config-fd9ed4e5e826674131f4887853150d3795dd222f.zip
refactor(hosts): Also move bluetooth and graphics to separate modules
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/bluetooth/default.nix20
-rw-r--r--modules/system/default.nix1
-rw-r--r--modules/system/hardware/default.nix19
3 files changed, 37 insertions, 3 deletions
diff --git a/modules/system/bluetooth/default.nix b/modules/system/bluetooth/default.nix
new file mode 100644
index 00000000..bf1c6a90
--- /dev/null
+++ b/modules/system/bluetooth/default.nix
@@ -0,0 +1,20 @@
+{
+  config,
+  lib,
+  ...
+}: let
+  cfg = config.soispha.bluetooth;
+in {
+  options.soispha.bluetooth = {
+    enable = lib.mkEnableOption "an integrated bluetooth setup.";
+  };
+
+  config = lib.mkIf cfg.enable {
+    hardware = {
+      bluetooth = {
+        enable = true;
+        powerOnBoot = !config.soispha.laptop.enable;
+      };
+    };
+  };
+}
diff --git a/modules/system/default.nix b/modules/system/default.nix
index ecd6eb63..85f8dfb3 100644
--- a/modules/system/default.nix
+++ b/modules/system/default.nix
@@ -2,6 +2,7 @@
   cfg = config.soispha;
 in {
   imports = [
+    ./bluetooth
     ./boot
     ./cleanup
     ./disks
diff --git a/modules/system/hardware/default.nix b/modules/system/hardware/default.nix
index d2d7d146..850416b7 100644
--- a/modules/system/hardware/default.nix
+++ b/modules/system/hardware/default.nix
@@ -7,21 +7,34 @@
   cfg = config.soispha.hardware;
 in {
   options.soispha.hardware = {
-    enable = lib.mkEnableOption "udev rules for devices I use";
+    enable = lib.mkEnableOption "the various hardware dependend things (and graphics drivers)";
     moonlander = {
       enableLiveTraining = lib.mkEnableOption "udev rules for live training";
       enableFlashing = lib.mkEnableOption "udev rules for firmware flashing";
     };
+
+    cpuType = lib.mkOption {
+      type = lib.types.enum ["amd" "intel"];
+      description = ''
+        The manuafacturer of the used cpu.
+
+        This is used to enable, for example, the correct microcode updates.
+      '';
+    };
   };
 
   config = lib.mkIf cfg.enable {
     hardware = {
+      cpu.amd.updateMicrocode = cfg.cpuType == "amd";
+      cpu.intel.updateMicrocode = cfg.cpuType == "intel";
+
+      # This is enabled manually to support older firmware.
       keyboard.zsa.enable = false;
-      nitrokey.enable = true;
 
+      nitrokey.enable = true;
       onlykey.enable = false;
 
-      opengl = {
+      graphics = {
         enable = true;
         extraPackages = builtins.attrValues {
           inherit