Commit 4fd0fa2

HPCesia <me@hpcesia.com>
2025-05-30 16:08:12
feat(service): peripherals
Move bluetooth config to module.
1 parent 6c12a8a
Changed files (3)
home
linux
gui
plasma
apps
hosts
chaser-kevin
modules
nixos
home/linux/gui/plasma/apps/vscode/default.nix
@@ -2,4 +2,4 @@
   programs.vscode = {
     enable = true;
   };
-}
\ No newline at end of file
+}
hosts/chaser-kevin/miscs.nix
@@ -1,4 +1,8 @@
-{lib, pkgs, ...}: {
+{
+  lib,
+  pkgs,
+  ...
+}: {
   # Lid Settings
   services.logind = {
     lidSwitch = "hibernate";
@@ -13,12 +17,6 @@
     serviceConfig.Type = "simple";
   };
 
-  # Bluetooth
-  hardware.bluetooth = {
-    enable = true;
-    powerOnBoot = true;
-  };
-
   # Cooling management
   services.thermald.enable = lib.mkDefault true;
 
@@ -26,7 +24,7 @@
   services.libinput.enable = true;
 
   # Network Manager
-	environment.systemPackages = with pkgs; [ networkmanagerapplet ];
+  environment.systemPackages = with pkgs; [networkmanagerapplet];
 
   # √(3200² + 2000²) px / 16 in ≃ 235 dpi
   services.xserver.dpi = 235;
modules/nixos/desktop/peripherals.nix
@@ -0,0 +1,46 @@
+{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
+  # or you can use cli:
+  # $ bluetoothctl
+  # [bluetooth] # power on
+  # [bluetooth] # agent on
+  # [bluetooth] # default-agent
+  # [bluetooth] # scan on
+  # ...put device in pairing mode and wait [hex-address] to appear here...
+  # [bluetooth] # pair [hex-address]
+  # [bluetooth] # connect [hex-address]
+  # Bluetooth devices automatically connect with bluetoothctl as well:
+  # [bluetooth] # trust [hex-address]
+  hardware.bluetooth.enable = true;
+  services.blueman.enable = true;
+}