Commit e7aba09

HPCesia <me@hpcesia.com>
2025-10-04 15:21:05
refactor: migrate pipewire
1 parent 7379220
Changed files (2)
modules
os-modules
nixos
modules/desktop/pipewire.nix
@@ -0,0 +1,27 @@
+{
+  flake.modules.nixos.desktop = {pkgs, ...}: {
+    environment.systemPackages = with pkgs; [
+      pulseaudio # provides `pactl`, which is required by some apps(e.g. sonic-pi)
+    ];
+
+    # PipeWire is a new low-level multimedia framework.
+    # It aims to offer capture and playback for both audio and video with minimal latency.
+    # It support for PulseAudio-, JACK-, ALSA- and GStreamer-based applications.
+    # PipeWire has a great bluetooth support, it can be a good alternative to PulseAudio.
+    #     https://nixos.wiki/wiki/PipeWire
+    services.pipewire = {
+      enable = true;
+      # package = pkgs-unstable.pipewire;
+      alsa.enable = true;
+      alsa.support32Bit = true;
+      pulse.enable = true;
+      # If you want to use JACK applications, uncomment this
+      jack.enable = true;
+      wireplumber.enable = true;
+    };
+    # rtkit is optional but recommended
+    security.rtkit.enable = true;
+    # Disable pulseaudio, it conflicts with pipewire too.
+    services.pulseaudio.enable = false;
+  };
+}
os-modules/nixos/desktop/peripherals.nix
@@ -1,32 +1,4 @@
-{pkgs, ...}: {
-  #============================= Audio(PipeWire) =======================
-
-  # List packages installed in system profile. To search, run:
-  # $ nix search wget
-  environment.systemPackages = with pkgs; [
-    pulseaudio # provides `pactl`, which is required by some apps(e.g. sonic-pi)
-  ];
-
-  # PipeWire is a new low-level multimedia framework.
-  # It aims to offer capture and playback for both audio and video with minimal latency.
-  # It support for PulseAudio-, JACK-, ALSA- and GStreamer-based applications.
-  # PipeWire has a great bluetooth support, it can be a good alternative to PulseAudio.
-  #     https://nixos.wiki/wiki/PipeWire
-  services.pipewire = {
-    enable = true;
-    # package = pkgs-unstable.pipewire;
-    alsa.enable = true;
-    alsa.support32Bit = true;
-    pulse.enable = true;
-    # If you want to use JACK applications, uncomment this
-    jack.enable = true;
-    wireplumber.enable = true;
-  };
-  # rtkit is optional but recommended
-  security.rtkit.enable = true;
-  # Disable pulseaudio, it conflicts with pipewire too.
-  services.pulseaudio.enable = false;
-
+{
   #============================= Bluetooth =============================
 
   # enable bluetooth & gui paring tools - blueman
@@ -42,5 +14,5 @@
   # Bluetooth devices automatically connect with bluetoothctl as well:
   # [bluetooth] # trust [hex-address]
   hardware.bluetooth.enable = true;
-  # services.blueman.enable = true; # KDE has bluetooth manager
+  services.blueman.enable = true; # KDE has bluetooth manager
 }