From 04c22c3d50e9aef730429373f251422d397a6ac1 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sun, 26 May 2024 00:36:48 -0400 Subject: [PATCH] sway/hyprland: marry defaults in waylandComp module --- nixosModules/desktop/default.nix | 1 + nixosModules/desktop/greetd/default.nix | 4 ++++ nixosModules/desktop/hyprland/default.nix | 14 +---------- nixosModules/desktop/sway/default.nix | 14 ++--------- nixosModules/desktop/waylandComp.nix | 29 +++++++++++++++++++++++ 5 files changed, 37 insertions(+), 25 deletions(-) create mode 100644 nixosModules/desktop/waylandComp.nix diff --git a/nixosModules/desktop/default.nix b/nixosModules/desktop/default.nix index 8a36601b..93ab6026 100644 --- a/nixosModules/desktop/default.nix +++ b/nixosModules/desktop/default.nix @@ -13,6 +13,7 @@ ./lightdm ./plasma ./sway + ./waylandComp.nix ]; options = { diff --git a/nixosModules/desktop/greetd/default.nix b/nixosModules/desktop/greetd/default.nix index f0865df7..bfd6ce22 100644 --- a/nixosModules/desktop/greetd/default.nix +++ b/nixosModules/desktop/greetd/default.nix @@ -26,6 +26,10 @@ }; config = lib.mkIf config.alyraffauf.desktop.greetd.enable { + security.pam.services = { + greetd.enableKwallet = lib.mkDefault true; + greetd.enableGnomeKeyring = lib.mkDefault true; + }; services = { greetd = { enable = true; diff --git a/nixosModules/desktop/hyprland/default.nix b/nixosModules/desktop/hyprland/default.nix index f9855437..15a707f8 100644 --- a/nixosModules/desktop/hyprland/default.nix +++ b/nixosModules/desktop/hyprland/default.nix @@ -11,21 +11,9 @@ }; config = lib.mkIf config.alyraffauf.desktop.hyprland.enable { - services = { - dbus.packages = [pkgs.gcr]; - udev.packages = [pkgs.swayosd]; - gnome.gnome-keyring.enable = true; - blueman.enable = true; - }; - - security.pam.services = { - greetd.enableKwallet = true; - greetd.enableGnomeKeyring = true; - swaylock = {}; - }; + alyraffauf.desktop.waylandComp.enable = true; programs = { - gnupg.agent.pinentryPackage = pkgs.pinentry-gnome3; hyprland = { enable = true; package = inputs.nixpkgsUnstable.legacyPackages."${pkgs.system}".hyprland; diff --git a/nixosModules/desktop/sway/default.nix b/nixosModules/desktop/sway/default.nix index 357e41c1..30a401d4 100644 --- a/nixosModules/desktop/sway/default.nix +++ b/nixosModules/desktop/sway/default.nix @@ -11,22 +11,12 @@ }; config = lib.mkIf config.alyraffauf.desktop.sway.enable { + alyraffauf.desktop.waylandComp.enable = true; services = { - blueman.enable = true; - dbus.packages = [pkgs.gcr]; - geoclue2.enable = true; - gnome.gnome-keyring.enable = true; - udev.packages = [pkgs.swayosd]; - }; - - security.pam.services = { - greetd.enableKwallet = true; - greetd.enableGnomeKeyring = true; - swaylock = {}; + geoclue2.enable = lib.mkDefault true; }; programs = { - gnupg.agent.pinentryPackage = pkgs.pinentry-gnome3; sway = { enable = true; package = inputs.nixpkgsUnstable.legacyPackages."${pkgs.system}".swayfx; diff --git a/nixosModules/desktop/waylandComp.nix b/nixosModules/desktop/waylandComp.nix new file mode 100644 index 00000000..efb9cfcd --- /dev/null +++ b/nixosModules/desktop/waylandComp.nix @@ -0,0 +1,29 @@ +{ + inputs, + pkgs, + lib, + config, + ... +}: { + options = { + alyraffauf.desktop.waylandComp.enable = + lib.mkEnableOption "Shared defaults for wayland compositors."; + }; + + config = lib.mkIf config.alyraffauf.desktop.waylandComp.enable { + services = { + blueman.enable = lib.mkDefault true; + dbus.packages = [pkgs.gcr]; + gnome.gnome-keyring.enable = lib.mkDefault true; + udev.packages = [pkgs.swayosd]; + }; + + security.pam.services = { + swaylock = {}; + }; + + programs = { + gnupg.agent.pinentryPackage = lib.mkForce pkgs.pinentry-gnome3; + }; + }; +}