diff options
author | Franck Cuny <franck@fcuny.net> | 2022-04-05 16:47:35 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2022-04-05 16:47:35 -0700 |
commit | 608deed2aaa88f88cb9230b9132294581b63bbab (patch) | |
tree | 702df49d0581bdfe2da66ccac315c9b262dca1de | |
parent | waybar: fix colors for the workspaces (diff) | |
download | world-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-- | hosts/aptos/default.nix | 1 | ||||
-rw-r--r-- | hosts/aptos/sound.nix | 1 | ||||
-rw-r--r-- | hosts/carmel/default.nix | 24 | ||||
-rw-r--r-- | hosts/common/desktop/default.nix | 9 | ||||
-rw-r--r-- | hosts/common/desktop/sound.nix | 22 | ||||
-rw-r--r-- | hosts/sound.nix | 1 | ||||
-rw-r--r-- | lib/default.nix | 1 | ||||
-rw-r--r-- | modules/default.nix | 1 | ||||
-rw-r--r-- | modules/hardware/default.nix | 5 | ||||
-rw-r--r-- | modules/hardware/sound/default.nix | 35 | ||||
-rw-r--r-- | users/fcuny/desktop/wm/default.nix | 3 |
11 files changed, 59 insertions, 44 deletions
diff --git a/hosts/aptos/default.nix b/hosts/aptos/default.nix index f3ed313..95f4b81 100644 --- a/hosts/aptos/default.nix +++ b/hosts/aptos/default.nix @@ -3,6 +3,7 @@ { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ./sound.nix ../common/desktop ../common/system/tailscale.nix ../common/hardware/xps9300.nix diff --git a/hosts/aptos/sound.nix b/hosts/aptos/sound.nix new file mode 100644 index 0000000..947f9cd --- /dev/null +++ b/hosts/aptos/sound.nix @@ -0,0 +1 @@ +{ ... }: { my.hardware.sound = { pipewire = { enable = true; }; }; } diff --git a/hosts/carmel/default.nix b/hosts/carmel/default.nix index 0234e90..ecc8362 100644 --- a/hosts/carmel/default.nix +++ b/hosts/carmel/default.nix @@ -1,13 +1,13 @@ { config, pkgs, hostname, ... }: { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ../common/desktop - # In order to unlock the root disk remotely - ../common/system/boot-ssh.nix - ]; + imports = [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ./sound.nix + ../common/desktop + # In order to unlock the root disk remotely + ../common/system/boot-ssh.nix + ]; boot = { # get an IP address on boot, so we can unlock the root disk remotely @@ -27,13 +27,11 @@ networks = { enp9s0 = { matchConfig.Name = "enp9s0"; - networkConfig = { - DHCP = "yes"; - }; + networkConfig = { DHCP = "yes"; }; extraConfig = '' - [DHCPv4] - UseDNS=yes - UseDomains=yes + [DHCPv4] + UseDNS=yes + UseDomains=yes ''; }; }; diff --git a/hosts/common/desktop/default.nix b/hosts/common/desktop/default.nix index b5effa9..6a752b6 100644 --- a/hosts/common/desktop/default.nix +++ b/hosts/common/desktop/default.nix @@ -1,10 +1,5 @@ -{lib, config, pkgs, ...}: -{ - imports = [ - ./fonts.nix - ./sound.nix - ./xserver.nix - ]; +{ lib, config, pkgs, ... }: { + imports = [ ./fonts.nix ./xserver.nix ]; services.avahi.enable = true; # Important to resolve .local domains of printers, otherwise you get an error diff --git a/hosts/common/desktop/sound.nix b/hosts/common/desktop/sound.nix deleted file mode 100644 index c72875d..0000000 --- a/hosts/common/desktop/sound.nix +++ /dev/null @@ -1,22 +0,0 @@ -{pkgs, config, lib, ...}: - -{ - sound.enable = true; - - 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 - ]; - - services.pipewire = { - enable = true; - # Compatibility shims, adjust according to your needs - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - }; - hardware.pulseaudio.enable = false; -} diff --git a/hosts/sound.nix b/hosts/sound.nix new file mode 100644 index 0000000..947f9cd --- /dev/null +++ b/hosts/sound.nix @@ -0,0 +1 @@ +{ ... }: { my.hardware.sound = { pipewire = { enable = true; }; }; } diff --git a/lib/default.nix b/lib/default.nix index bb1c30f..ccf204e 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -12,6 +12,7 @@ }; modules = [ inputs.agenix.nixosModules.age + ../modules ../hosts/common ../hosts/${hostname} ./private-wireguard.nix 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; + }; +} diff --git a/users/fcuny/desktop/wm/default.nix b/users/fcuny/desktop/wm/default.nix index 4f39c14..24c7f8e 100644 --- a/users/fcuny/desktop/wm/default.nix +++ b/users/fcuny/desktop/wm/default.nix @@ -8,8 +8,7 @@ ./screenshot.nix ]; - home.packages = - [ pkgs.pavucontrol pkgs.wev pkgs.wf-recorder pkgs.wofi pkgs.wlogout ]; + home.packages = [ pkgs.wev pkgs.wf-recorder pkgs.wofi pkgs.wlogout ]; home.sessionVariables = { MOZ_ENABLE_WAYLAND = true; |