From b838caa222d5b250a46caccbf874f90fef063731 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner <contact@ingolf-wagner.de> Date: Tue, 18 Feb 2025 17:08:58 +1300 Subject: [PATCH] :wrench: sharpen the xorg component a bit --- components/gui/audio.nix | 77 +++++++++------- components/gui/default.nix | 1 + components/gui/kde.nix | 19 ++++ components/gui/xorg/default.nix | 147 ++++++++++++++++-------------- machines/cherry/configuration.nix | 1 + 5 files changed, 144 insertions(+), 101 deletions(-) create mode 100644 components/gui/kde.nix diff --git a/components/gui/audio.nix b/components/gui/audio.nix index 1407bdf..8a19b26 100644 --- a/components/gui/audio.nix +++ b/components/gui/audio.nix @@ -12,45 +12,54 @@ with lib; default = config.components.gui.enable; }; - config = mkIf (config.components.gui.audio.enable) { + config = mkMerge [ + (mkIf (config.components.gui.audio.enable) { - security.rtkit.enable = true; + security.rtkit.enable = true; + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + }; - services.pulseaudio.enable = false; + environment.systemPackages = with pkgs; [ + alsa-utils - hardware.bluetooth = { - enable = true; - powerOnBoot = true; - }; + # PulseAudio control + # ------------------ + ponymix + pavucontrol + lxqt.pavucontrol-qt + ]; - environment.systemPackages = with pkgs; [ - alsa-utils + services.pipewire = { + #enable = true; + systemWide = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; - # PulseAudio control - # ------------------ - ponymix - pavucontrol - lxqt.pavucontrol-qt - ]; + environment.etc = { + "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = '' + bluez_monitor.properties = { + ["bluez5.enable-sbc-xq"] = true, + ["bluez5.enable-msbc"] = true, + ["bluez5.enable-hw-volume"] = true, + ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]" + } + ''; + }; + }) - services.pipewire = { - enable = true; - systemWide = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - }; + { - environment.etc = { - "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = '' - bluez_monitor.properties = { - ["bluez5.enable-sbc-xq"] = true, - ["bluez5.enable-msbc"] = true, - ["bluez5.enable-hw-volume"] = true, - ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]" - } - ''; - }; - }; + # this is always true + # seems other options enable this one + services.pipewire.enable = config.components.gui.audio.enable; + services.pulseaudio.enable = false; + + } + + ]; } diff --git a/components/gui/default.nix b/components/gui/default.nix index ad386e3..c4e5e6f 100644 --- a/components/gui/default.nix +++ b/components/gui/default.nix @@ -16,6 +16,7 @@ with lib; ./browser.nix ./cups.nix ./home-manager + ./kde.nix ./kmonad.nix ./noti.nix # todo: make this different (use password store and such) ./pass.nix diff --git a/components/gui/kde.nix b/components/gui/kde.nix new file mode 100644 index 0000000..d50959d --- /dev/null +++ b/components/gui/kde.nix @@ -0,0 +1,19 @@ +{ + config, + pkgs, + lib, + ... +}: +{ + + options.components.gui.kde.enable = lib.mkOption { + type = lib.types.bool; + default = config.components.gui.enable; + }; + + config = lib.mkIf (config.components.gui.kde.enable) { + + services.desktopManager.plasma6.enable = true; + + }; +} diff --git a/components/gui/xorg/default.nix b/components/gui/xorg/default.nix index 35f0a3a..aa4374d 100644 --- a/components/gui/xorg/default.nix +++ b/components/gui/xorg/default.nix @@ -14,72 +14,85 @@ with lib; default = config.components.gui.enable; }; - config = mkIf (config.components.gui.xorg.enable && config.components.gui.enable) { - - # system.custom.fonts.enable = true; - services.displayManager = { - defaultSession = lib.mkDefault "none+i3"; - autoLogin.enable = lib.mkDefault true; - autoLogin.user = config.users.users.mainUser.name; - }; - - services.xserver = { - - enable = true; - - displayManager = { - lightdm.enable = lib.mkDefault true; - }; - - desktopManager.xterm.enable = false; - windowManager.i3.enable = true; - - # mouse/touchpad - # -------------- - - }; - - services.libinput = { - enable = true; - touchpad = { - disableWhileTyping = true; - tapping = true; - scrollMethod = "twofinger"; - accelSpeed = "1.3"; - naturalScrolling = true; - horizontalScrolling = true; - }; - }; - - # Packages - # -------- - environment.systemPackages = with pkgs; [ - - xclip - #xtrlock-pam - xorg.xev - - dmenu - arandr - xcalib - flameshot - feh - - ]; - - # Xresources config - # ----------------- - # spread the Xresource config - # across different files - # just add a file into `/etc/X11/Xresource.d/` and it will be - # evaluated. - services.xserver.displayManager.sessionCommands = '' - for file in `ls /etc/X11/Xresource.d/` - do - ${pkgs.xorg.xrdb}/bin/xrdb -merge /etc/X11/Xresource.d/$file - done - ''; - environment.etc."/X11/Xresource.d/.keep".text = ""; - + options.components.gui.xorg.lightdm.enable = mkOption { + type = lib.types.bool; + default = config.components.gui.xorg.enable; }; + + options.components.gui.xorg.sddm.enable = mkOption { + type = lib.types.bool; + default = !config.components.gui.xorg.lightdm.enable; + }; + + config = mkMerge [ + + (mkIf (config.components.gui.xorg.lightdm.enable && config.components.gui.xorg.enable) { + + services.displayManager = { + defaultSession = "none+i3"; + autoLogin.enable = lib.mkDefault true; + autoLogin.user = config.users.users.mainUser.name; + }; + + services.xserver.displayManager.lightdm.enable = true; + + }) + + (mkIf (config.components.gui.xorg.sddm.enable && config.components.gui.xorg.enable) { + + services.xserver.displayManager.sddm.enable = true; + + }) + + (mkIf (config.components.gui.xorg.enable && config.components.gui.enable) { + + services.xserver.enable = true; + + services.xserver.windowManager.i3.enable = true; + + services.libinput = { + enable = true; + touchpad = { + disableWhileTyping = true; + tapping = true; + scrollMethod = "twofinger"; + accelSpeed = "1.3"; + naturalScrolling = true; + horizontalScrolling = true; + }; + }; + + # Packages + # -------- + environment.systemPackages = with pkgs; [ + + xclip + #xtrlock-pam + xorg.xev + + dmenu + arandr + xcalib + flameshot + feh + + ]; + + # Xresources config + # ----------------- + # spread the Xresource config + # across different files + # just add a file into `/etc/X11/Xresource.d/` and it will be + # evaluated. + services.xserver.displayManager.sessionCommands = '' + for file in `ls /etc/X11/Xresource.d/` + do + ${pkgs.xorg.xrdb}/bin/xrdb -merge /etc/X11/Xresource.d/$file + done + ''; + environment.etc."/X11/Xresource.d/.keep".text = ""; + + }) + + ]; } diff --git a/machines/cherry/configuration.nix b/machines/cherry/configuration.nix index 105ce19..898bfab 100644 --- a/machines/cherry/configuration.nix +++ b/machines/cherry/configuration.nix @@ -55,6 +55,7 @@ components.virtualisation.enable = true; components.gui.enable = true; + components.gui.audio.enable = false; components.mainUser.enable = true; components.media.enable = true; components.media.tts-client.enable = false;