aboutsummaryrefslogtreecommitdiff
path: root/modules/hardware
diff options
context:
space:
mode:
Diffstat (limited to 'modules/hardware')
-rw-r--r--modules/hardware/amd/default.nix13
-rw-r--r--modules/hardware/bluetooth/default.nix64
-rw-r--r--modules/hardware/default.nix5
-rw-r--r--modules/hardware/intel/default.nix13
-rw-r--r--modules/hardware/networking/default.nix11
-rw-r--r--modules/hardware/sound/default.nix36
-rw-r--r--modules/hardware/ssd/default.nix5
7 files changed, 147 insertions, 0 deletions
diff --git a/modules/hardware/amd/default.nix b/modules/hardware/amd/default.nix
new file mode 100644
index 0000000..05362db
--- /dev/null
+++ b/modules/hardware/amd/default.nix
@@ -0,0 +1,13 @@
+{ config, lib, ... }:
+let cfg = config.my.hardware.amd;
+in {
+ options.my.hardware.amd = with lib; {
+ enable = mkEnableOption "AMD related configuration";
+ };
+
+ config = lib.mkIf cfg.enable {
+ # Enable microcode update
+ hardware.cpu.amd.updateMicrocode = true;
+ boot.kernelModules = [ "kvm-amd" ];
+ };
+}
diff --git a/modules/hardware/bluetooth/default.nix b/modules/hardware/bluetooth/default.nix
new file mode 100644
index 0000000..cfb9a25
--- /dev/null
+++ b/modules/hardware/bluetooth/default.nix
@@ -0,0 +1,64 @@
+{ config, lib, pkgs, ... }:
+let cfg = config.my.hardware.bluetooth;
+in {
+ options.my.hardware.bluetooth = with lib; {
+ enable = mkEnableOption "bluetooth configuration";
+ };
+
+ config = lib.mkIf cfg.enable {
+ hardware.bluetooth.enable = true;
+ services.blueman.enable = true;
+
+ hardware.pulseaudio = {
+ extraModules = [ pkgs.pulseaudio-modules-bt ];
+ package = pkgs.pulseaudioFull;
+ };
+
+ environment.etc = {
+ "wireplumber/bluetooth.lua.d/50-bluez-config.lua".text = ''
+ bluez_monitor.properties = {
+ ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
+ -- mSBC provides better audio + microphone
+ ["bluez5.enable-msbc"] = true,
+ -- SBC XQ provides better audio
+ ["bluez5.enable-sbc-xq"] = true,
+ -- Hardware volume control
+ ["bluez5.enable-hw-volume"] = true,
+ }
+ '';
+ };
+
+ services.pipewire = {
+ media-session.config.bluez-monitor.rules = [
+ {
+ # Matches all cards
+ matches = [{ "device.name" = "~bluez_card.*"; }];
+ actions = {
+ "update-props" = {
+ "bluez5.reconnect-profiles" = [ "hfp_hf" "hsp_hs" "a2dp_sink" ];
+ # mSBC provides better audio + microphone
+ "bluez5.msbc-support" = true;
+ # SBC XQ provides better audio
+ "bluez5.sbc-xq-support" = true;
+ };
+ };
+ }
+ {
+ matches = [
+ # Matches all sources
+ {
+ "node.name" = "~bluez_input.*";
+ }
+ # Matches all outputs
+ { "node.name" = "~bluez_output.*"; }
+ ];
+ actions = { "node.pause-on-idle" = false; };
+ }
+ ];
+ };
+
+ hardware.bluetooth.settings = {
+ General = { Enable = "Source,Sink,Media,Socket"; };
+ };
+ };
+}
diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix
new file mode 100644
index 0000000..21e4713
--- /dev/null
+++ b/modules/hardware/default.nix
@@ -0,0 +1,5 @@
+{ ... }:
+
+{
+ imports = [ ./amd ./bluetooth ./intel ./ssd ./sound ./networking ];
+}
diff --git a/modules/hardware/intel/default.nix b/modules/hardware/intel/default.nix
new file mode 100644
index 0000000..9a53f35
--- /dev/null
+++ b/modules/hardware/intel/default.nix
@@ -0,0 +1,13 @@
+{ config, lib, ... }:
+let cfg = config.my.hardware.intel;
+in {
+ options.my.hardware.intel = with lib; {
+ enable = mkEnableOption "intel related configuration";
+ };
+
+ config = lib.mkIf cfg.enable {
+ # Enable microcode update
+ hardware.cpu.intel.updateMicrocode = true;
+ boot.kernelModules = [ "kvm-intel" ];
+ };
+}
diff --git a/modules/hardware/networking/default.nix b/modules/hardware/networking/default.nix
new file mode 100644
index 0000000..d19388b
--- /dev/null
+++ b/modules/hardware/networking/default.nix
@@ -0,0 +1,11 @@
+{ config, lib, ... }:
+let cfg = config.my.hardware.networking;
+in {
+ options.my.hardware.networking = with lib; {
+ wireless = { enable = mkEnableOption "wireless configuration"; };
+ };
+
+ config = lib.mkMerge [
+ (lib.mkIf cfg.wireless.enable { networking.wireless.iwd.enable = true; })
+ ];
+}
diff --git a/modules/hardware/sound/default.nix b/modules/hardware/sound/default.nix
new file mode 100644
index 0000000..dc9f079
--- /dev/null
+++ b/modules/hardware/sound/default.nix
@@ -0,0 +1,36 @@
+{ config, lib, pkgs, ... }:
+let cfg = config.my.hardware.sound;
+in {
+ options.my.hardware.sound = with lib; {
+ pipewire = { enable = mkEnableOption "pipewire configuration"; };
+ };
+
+ config = lib.mkIf cfg.pipewire.enable {
+ sound.enable = true;
+
+ # RealtimeKit is recommended
+ security.rtkit.enable = true;
+
+ environment.systemPackages = with pkgs; [
+ # We install it to get access to pactl. It isn't enabled or run as a service.
+ pulseaudio
+ pavucontrol
+ easyeffects
+ ];
+
+ services.pipewire = {
+ enable = true;
+
+ alsa = {
+ enable = true;
+ support32Bit = true;
+ };
+
+ pulse = { enable = true; };
+
+ jack = { enable = true; };
+ };
+
+ hardware.pulseaudio.enable = false;
+ };
+}
diff --git a/modules/hardware/ssd/default.nix b/modules/hardware/ssd/default.nix
new file mode 100644
index 0000000..935c217
--- /dev/null
+++ b/modules/hardware/ssd/default.nix
@@ -0,0 +1,5 @@
+{ ... }:
+
+{
+ services.fstrim.enable = true;
+}