From efdece03b94760b573c22feac46efb44eb63cb90 Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Sun, 20 Aug 2023 21:39:15 +0200 Subject: [PATCH] pinwheel: Extract sound config into module --- hosts/pinwheel/configuration.nix | 18 ++------------ hosts/pinwheel/modules/sound/default.nix | 30 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 16 deletions(-) create mode 100644 hosts/pinwheel/modules/sound/default.nix diff --git a/hosts/pinwheel/configuration.nix b/hosts/pinwheel/configuration.nix index f97bd67..34d5fea 100644 --- a/hosts/pinwheel/configuration.nix +++ b/hosts/pinwheel/configuration.nix @@ -13,6 +13,7 @@ ./modules/syncthing ./modules/firefox ./modules/light + ./modules/sound ]; nix.settings.experimental-features = [ "nix-command" "flakes" ]; @@ -58,23 +59,8 @@ security.polkit.enable = true; hardware.opengl.enable = true; - programs.dconf.enable = true; - # Sound - hardware.pulseaudio.enable = false; - hardware.bluetooth.enable = true; - services.blueman.enable = true; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - wireplumber.enable = true; - - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - # Configure console keymap console.keyMap = "sv-latin1"; @@ -82,7 +68,7 @@ users.users.alex = { isNormalUser = true; description = "alex"; - extraGroups = [ "networkmanager" "wheel" "audio" ]; + extraGroups = [ "networkmanager" "wheel" ]; shell = pkgs.zsh; packages = with pkgs; []; }; diff --git a/hosts/pinwheel/modules/sound/default.nix b/hosts/pinwheel/modules/sound/default.nix new file mode 100644 index 0000000..f1a3e83 --- /dev/null +++ b/hosts/pinwheel/modules/sound/default.nix @@ -0,0 +1,30 @@ +{ home-manager, pkgs, ... }: +{ + users.users.alex.extraGroups = [ "audio" ]; + + hardware.pulseaudio.enable = false; + hardware.bluetooth.enable = true; + services.blueman.enable = true; + security.rtkit.enable = true; + + services.pipewire = { + enable = true; + wireplumber.enable = true; + + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + home-manager.users.alex = { + wayland.windowManager.hyprland = { + settings = { + bind = [ + ", XF86AudioRaiseVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 2%+" + ", XF86AudioLowerVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-" + ", XF86AudioMute, exec, ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + ]; + }; + }; + }; +}