From 3534ccfe769891d1f9013964c2d850377bbb0d41 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Wed, 30 Nov 2022 14:54:05 +0100 Subject: [PATCH] hardware/sound: modularize --- modules/hardware/default.nix | 1 + modules/hardware/sound/default.nix | 37 +++++++++++++++++++++++ nixos/modules/sound.nix | 22 -------------- nixos/thinkman/hardware-configuration.nix | 1 + 4 files changed, 39 insertions(+), 22 deletions(-) create mode 100644 modules/hardware/sound/default.nix delete mode 100644 nixos/modules/sound.nix diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix index 29f47cb..d789325 100644 --- a/modules/hardware/default.nix +++ b/modules/hardware/default.nix @@ -4,5 +4,6 @@ { imports = [ ./nitrokey + ./sound ]; } diff --git a/modules/hardware/sound/default.nix b/modules/hardware/sound/default.nix new file mode 100644 index 0000000..552ff30 --- /dev/null +++ b/modules/hardware/sound/default.nix @@ -0,0 +1,37 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.my.hardware.sound; +in +{ + options.my.hardware.sound = { + enable = lib.mkEnableOption "sound configuration with pipewire"; + }; + + config = lib.mkIf cfg.enable { + + # RealtimeKit is recommended + security.rtkit.enable = true; + + services.pipewire = { + enable = true; + + alsa = { + enable = true; + support32Bit = true; + }; + + pulse.enable = true; + + jack.enable = true; + }; + + programs.noisetorch.enable = true; + + environment.systemPackages = with pkgs; [ + noisetorch + pavucontrol + playerctl + pulseaudio # provide pactl to enable keyboard shortcuts + ]; + }; +} diff --git a/nixos/modules/sound.nix b/nixos/modules/sound.nix deleted file mode 100644 index f3833a2..0000000 --- a/nixos/modules/sound.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ config, pkgs, ... }: -{ - sound.enable = true; - - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - - # programs.noisetorch.enable = true; - - environment.systemPackages = with pkgs; [ - # noisetorch - pavucontrol - playerctl - pulseaudio # provide pactl to enable keyboard shortcuts - ]; -} diff --git a/nixos/thinkman/hardware-configuration.nix b/nixos/thinkman/hardware-configuration.nix index 11571d1..dd71ad9 100644 --- a/nixos/thinkman/hardware-configuration.nix +++ b/nixos/thinkman/hardware-configuration.nix @@ -8,5 +8,6 @@ my.hardware = { nitrokey.enable = true; + sound.enable = true; }; }