about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/desktop/sound.nix35
-rw-r--r--modules/desktop/xserver.nix41
2 files changed, 44 insertions, 32 deletions
diff --git a/modules/desktop/sound.nix b/modules/desktop/sound.nix
index 95c7c75..11c3fc2 100644
--- a/modules/desktop/sound.nix
+++ b/modules/desktop/sound.nix
@@ -1,20 +1,27 @@
 {pkgs, config, lib, ...}:
+with lib;
 
-{
-  sound.enable = true;
+let
+  xorg = (elem "xorg" config.sys.graphics.desktopProtocols);
+  wayland = (elem "wayland" config.sys.graphics.desktopProtocols);
+  desktopMode = xorg || wayland;
+in {
+  config= mkIf desktopMode {
+    sound.enable = true;
 
-  environment.systemPackages = with pkgs; [
-    # We install it to get access to pactl. It isn't enabled or run as a service.
-    pulseaudio
-  ];
+    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;
+    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;
   };
-  hardware.pulseaudio.enable = false;
 }
diff --git a/modules/desktop/xserver.nix b/modules/desktop/xserver.nix
index 894b39b..d007bd8 100644
--- a/modules/desktop/xserver.nix
+++ b/modules/desktop/xserver.nix
@@ -1,26 +1,31 @@
 { config, pkgs, lib, ... }:
+with lib;
 
-{
-  services.xserver = {
-    enable = true;
-    layout = "us";
-    xkbOptions = "eurosign:e";
-    libinput.enable = true;
+let
+  xorg = (elem "xorg" config.sys.graphics.desktopProtocols);
+in {
+  config= mkIf xorg {
+    services.xserver = {
+      enable = true;
+      layout = "us";
+      xkbOptions = "eurosign:e";
+      libinput.enable = true;
 
-    desktopManager = {
-      xterm.enable = false;
-    };
+      desktopManager = {
+        xterm.enable = false;
+      };
 
-    displayManager = {
-      lightdm.enable = true;
-      defaultSession = "none+i3";
-    };
+      displayManager = {
+        lightdm.enable = true;
+        defaultSession = "none+i3";
+      };
 
-    windowManager = {
-      i3.enable = true;
+      windowManager = {
+        i3.enable = true;
+      };
     };
-  };
 
-  services.gnome.gnome-keyring.enable = true;
-  services.gvfs.enable = true;
+    services.gnome.gnome-keyring.enable = true;
+    services.gvfs.enable = true;
+  };
 }