From 95c3b00038af1d24ab44fa4ca11e9f59493efd03 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sat, 30 Mar 2024 14:48:48 -0400 Subject: [PATCH] cleaned up and abstracted hyprland module config into lightdm, desktopConfig, and systemConfig --- .../desktopEnv/hypr/default.nix | 9 +++-- nixosModules/desktopConfig/default.nix | 36 +++++++++---------- .../desktopEnvironments/plasma/default.nix | 1 - .../displayManagers/lightdm/default.nix | 4 +++ .../windowManagers/hyprland/default.nix | 11 ------ nixosModules/systemConfig/default.nix | 7 ++-- .../power-profiles-daemon/default.nix | 14 ++++++++ 7 files changed, 47 insertions(+), 35 deletions(-) create mode 100644 nixosModules/systemConfig/power-profiles-daemon/default.nix diff --git a/homeManagerModules/desktopEnv/hypr/default.nix b/homeManagerModules/desktopEnv/hypr/default.nix index 24faf68b..beacd917 100644 --- a/homeManagerModules/desktopEnv/hypr/default.nix +++ b/homeManagerModules/desktopEnv/hypr/default.nix @@ -30,8 +30,7 @@ hyprland-protocols hyprnome hyprshot - playerctls - xdg-desktop-portal-hyprland + playerctl xfce.exo xfce.ristretto xfce.thunar @@ -59,6 +58,12 @@ WebBrowser=firefox ''; + xdg.portal = { + enable = true; + configPackages = [ pkgs.xdg-desktop-portal-hyprland ]; + extraPortals = [ pkgs.xdg-desktop-portal-hyprland ]; + }; + home.pointerCursor = { gtk.enable = true; x11.enable = true; diff --git a/nixosModules/desktopConfig/default.nix b/nixosModules/desktopConfig/default.nix index 5e6a80ae..a7f8bf78 100644 --- a/nixosModules/desktopConfig/default.nix +++ b/nixosModules/desktopConfig/default.nix @@ -9,28 +9,26 @@ }; config = lib.mkIf config.desktopConfig.enable { - # Enable the X11 windowing system. - services.xserver = { - enable = true; - xkb.layout = "us"; - xkb.variant = ""; - excludePackages = with pkgs; [ xterm ]; + + services = { + gnome.gnome-keyring.enable = true; + gvfs.enable = true; # Mount, trash, etc. + # Enable the X11 windowing system. + xserver = { + enable = true; + xkb.layout = "us"; + xkb.variant = ""; + excludePackages = with pkgs; [ xterm ]; + }; }; # Install pretty fonts. - fonts.packages = with pkgs; - [ - liberation_ttf - (nerdfonts.override { - fonts = [ - "DroidSansMono" - "FiraCode" - "FiraMono" - "Hack" - "Noto" - ]; - }) - ]; + fonts.packages = with pkgs; [ + liberation_ttf + (nerdfonts.override { + fonts = [ "DroidSansMono" "FiraCode" "FiraMono" "Hack" "Noto" ]; + }) + ]; desktopConfig.windowManagers.hyprland.enable = lib.mkDefault true; }; diff --git a/nixosModules/desktopConfig/desktopEnvironments/plasma/default.nix b/nixosModules/desktopConfig/desktopEnvironments/plasma/default.nix index 015469cc..1f76fd87 100644 --- a/nixosModules/desktopConfig/desktopEnvironments/plasma/default.nix +++ b/nixosModules/desktopConfig/desktopEnvironments/plasma/default.nix @@ -31,7 +31,6 @@ programs.kdeconnect.enable = true; # nixpkgs.config.firefox.enablePlasmaBrowserIntegration = true; # nixpkgs.config.chromium.commandLineArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WaylandWindowDecorations --ozone-platform-hint=auto"; - services.gnome.gnome-keyring.enable = true; security.pam.services.sddm.enableGnomeKeyring = true; }; } diff --git a/nixosModules/desktopConfig/displayManagers/lightdm/default.nix b/nixosModules/desktopConfig/displayManagers/lightdm/default.nix index 213fa10b..151c9e26 100644 --- a/nixosModules/desktopConfig/displayManagers/lightdm/default.nix +++ b/nixosModules/desktopConfig/displayManagers/lightdm/default.nix @@ -6,6 +6,10 @@ }; config = lib.mkIf config.desktopConfig.displayManagers.lightdm.enable { + + security.pam.services.lightdm.enableKwallet = true; + security.pam.services.lightdm.enableGnomeKeyring = true; + services.xserver.displayManager.lightdm = { enable = true; greeters.slick = { diff --git a/nixosModules/desktopConfig/windowManagers/hyprland/default.nix b/nixosModules/desktopConfig/windowManagers/hyprland/default.nix index 4e5a399b..d3c5797f 100644 --- a/nixosModules/desktopConfig/windowManagers/hyprland/default.nix +++ b/nixosModules/desktopConfig/windowManagers/hyprland/default.nix @@ -10,20 +10,9 @@ desktopConfig.displayManagers.lightdm.enable = lib.mkDefault true; programs.hyprland.enable = true; - services.power-profiles-daemon.enable = true; - services.upower.enable = true; services.dbus.packages = [ pkgs.gcr ]; - services.gnome.gnome-keyring.enable = true; - security.pam.services.gdm.enableKwallet = true; - security.pam.services.gdm.enableGnomeKeyring = true; - - services.gvfs.enable = true; # Mount, trash, and other functionalities - services.tumbler.enable = true; # Thumbnail support for images - - xdg.portal.extraPortals = with pkgs; [ xdg-desktop-portal-hyprland ]; - environment.sessionVariables.NIXOS_OZONE_WL = "1"; }; } diff --git a/nixosModules/systemConfig/default.nix b/nixosModules/systemConfig/default.nix index 4544f907..fd0c099e 100644 --- a/nixosModules/systemConfig/default.nix +++ b/nixosModules/systemConfig/default.nix @@ -1,7 +1,10 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: { - imports = [ ./network.nix ./sound.nix ./plymouth ./zramSwap ]; + imports = [ ./network.nix ./sound.nix ./plymouth ./power-profiles-daemon ./zramSwap ]; + + + systemConfig.power-profiles-daemon.enable = lib.mkDefault true; # Set your time zone. time.timeZone = "America/New_York"; diff --git a/nixosModules/systemConfig/power-profiles-daemon/default.nix b/nixosModules/systemConfig/power-profiles-daemon/default.nix new file mode 100644 index 00000000..b653ece4 --- /dev/null +++ b/nixosModules/systemConfig/power-profiles-daemon/default.nix @@ -0,0 +1,14 @@ +{ pkgs, lib, config, ... }: { + + options = { + systemConfig.power-profiles-daemon.enable = lib.mkEnableOption + "Enables power-profiles-daemon."; + }; + + config = lib.mkIf config.systemConfig.power-profiles-daemon.enable { + services = { + power-profiles-daemon.enable = true; + upower.enable = true; + }; + }; +}