about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-04-05 16:47:35 -0700
committerFranck Cuny <franck@fcuny.net>2022-04-05 16:47:35 -0700
commit608deed2aaa88f88cb9230b9132294581b63bbab (patch)
tree702df49d0581bdfe2da66ccac315c9b262dca1de /modules
parentwaybar: fix colors for the workspaces (diff)
downloadworld-608deed2aaa88f88cb9230b9132294581b63bbab.tar.gz
sound: add a new module
This is the start of yet another refactoring of the configuration.

Sound configuration is moving to a module, and we enable it as needed at
the host level. It takes care of configuring pipewire and install the
packages needed too.

This module is applied to the laptop and the desktop.
Diffstat (limited to '')
-rw-r--r--modules/default.nix1
-rw-r--r--modules/hardware/default.nix5
-rw-r--r--modules/hardware/sound/default.nix35
3 files changed, 41 insertions, 0 deletions
diff --git a/modules/default.nix b/modules/default.nix
new file mode 100644
index 0000000..5ec7ef8
--- /dev/null
+++ b/modules/default.nix
@@ -0,0 +1 @@
+{ ... }: { imports = [ ./hardware ]; }
diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix
new file mode 100644
index 0000000..79b062e
--- /dev/null
+++ b/modules/hardware/default.nix
@@ -0,0 +1,5 @@
+{ ... }:
+
+{
+  imports = [ ./sound ];
+}
diff --git a/modules/hardware/sound/default.nix b/modules/hardware/sound/default.nix
new file mode 100644
index 0000000..95e5ebc
--- /dev/null
+++ b/modules/hardware/sound/default.nix
@@ -0,0 +1,35 @@
+{ 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
+    ];
+
+    services.pipewire = {
+      enable = true;
+
+      alsa = {
+        enable = true;
+        support32Bit = true;
+      };
+
+      pulse = { enable = true; };
+
+      jack = { enable = true; };
+    };
+
+    hardware.pulseaudio.enable = false;
+  };
+}