about summary refs log tree commit diff
path: root/hosts
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-04-05 16:47:35 -0700
committerFranck Cuny <franck@fcuny.net>2022-04-05 16:47:35 -0700
commit608deed2aaa88f88cb9230b9132294581b63bbab (patch)
tree702df49d0581bdfe2da66ccac315c9b262dca1de /hosts
parentwaybar: fix colors for the workspaces (diff)
downloadworld-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 'hosts')
-rw-r--r--hosts/aptos/default.nix1
-rw-r--r--hosts/aptos/sound.nix1
-rw-r--r--hosts/carmel/default.nix24
-rw-r--r--hosts/common/desktop/default.nix9
-rw-r--r--hosts/common/desktop/sound.nix22
-rw-r--r--hosts/sound.nix1
6 files changed, 16 insertions, 42 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; }; }; }