From 7a543cc8b685b3d9f1a55886d8ea5efa22e78d16 Mon Sep 17 00:00:00 2001 From: ChUrl Date: Sun, 16 Apr 2023 14:12:16 +0200 Subject: [PATCH] Add hyprland module --- home/christoph/default.nix | 73 +++--------------------------- home/modules/default.nix | 1 + home/modules/hyprland.nix | 92 ++++++++++++++++++++++++++++++++++++++ system/default.nix | 2 +- 4 files changed, 99 insertions(+), 69 deletions(-) create mode 100644 home/modules/hyprland.nix diff --git a/home/christoph/default.nix b/home/christoph/default.nix index 055f92a3..0c4cca39 100644 --- a/home/christoph/default.nix +++ b/home/christoph/default.nix @@ -91,6 +91,10 @@ rec { }; }; + hyprland = { + enable = true; + }; + # TODO: # plasma = { # enable = false; @@ -149,8 +153,6 @@ rec { # TODO: I need to pack all Plasma/Hyprland/Gnome related stuff into their respective modules # TODO: Then it should only be possible to activate one Desktop at a time - home.file.".config/hypr/polkit.conf".text = ''exec-once = ${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-agent-1 &''; - # Make fonts installed through user packages available to applications # NOTE: I don't think I need this anymore as all fonts are installed through the system config but let's keep this just in case fonts.fontconfig.enable = false; # Also updates the font-cache @@ -362,43 +364,8 @@ rec { AusweisApp2 - # TODO: Hyprland module - # TODO: These are mostly also present in the Plasma module, find a way to unify this? - libsForQt5.qt5ct # QT Configurator for unintegrated desktops - libsForQt5.ark - libsForQt5.dolphin - libsForQt5.dolphin-plugins - libsForQt5.ffmpegthumbs - libsForQt5.gwenview - libsForQt5.kalendar - libsForQt5.kate - libsForQt5.kcalc - libsForQt5.kcharselect - libsForQt5.kcolorpicker - libsForQt5.kdenetwork-filesharing - libsForQt5.kdegraphics-thumbnailers - libsForQt5.kfind - libsForQt5.kgpg - libsForQt5.kmail - libsForQt5.kompare # Can't be used as git merge tool, but more integrated than kdiff3 - libsForQt5.ksystemlog - libsForQt5.kwallet # TODO: How does this integrate with hyprland? - libsForQt5.kwalletmanager # TODO: Same as above - libsForQt5.kwrited - libsForQt5.okular - libsForQt5.plasma-systemmonitor - libsForQt5.spectacle - libsForQt5.skanlite - # Use NixCommunity binary cache cachix - - # TODO: Module - # Hyprland stuff - # dunst # NOTE: Use HM service - libsForQt5.polkit-kde-agent # No idea if that comes with KDE - slurp # Region selector for screensharing - # rofi-wayland # App launcher # NOTE: Use HM Program ]; # Packages with extra options managed by HomeManager natively @@ -523,23 +490,9 @@ rec { enable = true; }; - # NOTE: For Hyprland -> Enable from hyprland module - rofi = { - enable = true; - package = pkgs.rofi-wayland; - plugins = [ - pkgs.keepmenu # Rofi KeepassXC frontend - ]; - terminal = "${pkgs.kitty}/bin/kitty"; - - font = "JetBrains Mono 14"; - # theme = - # extraConfig = ''''; - }; - # Git status replacement with file selection by number scmpuff = { - enable = true; + enable = false; enableFishIntegration = true; }; @@ -682,17 +635,6 @@ rec { # TODO: Snippets }; - # TODO: Belongs to hyprland module - waybar = { - enable = true; - systemd = { - enable = false; - }; - - # settings = {}; - # style = ''''; - }; - # TODO: Check HM module options yt-dlp.enable = true; @@ -704,11 +646,6 @@ rec { services = { # kdeconnect.enable = true; # Note: This does not setup the firewall at all - - # TODO: To hyprland module, at least not for both, laptop and desktop - dunst = { - enable = true; - }; }; # Nicely reload system units when changing configs diff --git a/home/modules/default.nix b/home/modules/default.nix index 00e38b7c..5461b81e 100644 --- a/home/modules/default.nix +++ b/home/modules/default.nix @@ -16,6 +16,7 @@ ./flatpak.nix ./gaming.nix ./gnome.nix + ./hyprland.nix ./kitty.nix ./misc.nix ./neovim.nix diff --git a/home/modules/hyprland.nix b/home/modules/hyprland.nix new file mode 100644 index 00000000..5d0cd3ef --- /dev/null +++ b/home/modules/hyprland.nix @@ -0,0 +1,92 @@ +{ + config, + nixosConfig, + lib, + mylib, + pkgs, + ... +}: +with lib; +with mylib.modules; let + cfg = config.modules.hyprland; +in { + options.modules.hyprland = { + enable = mkEnableOpt "Hyprland Window Manager + Compositor"; + }; + + config = mkIf cfg.enable { + assertions = [ + { + assertion = nixosConfig.programs.hyprland.enable; + message = "Can't enable Hyprland module with Hyprland disabled!"; + } + ]; + + home.packages = with pkgs; [ + # TODO: These are mostly also present in the Plasma module, find a way to unify this? + libsForQt5.qt5ct # QT Configurator for unintegrated desktops + libsForQt5.ark + libsForQt5.dolphin + libsForQt5.dolphin-plugins + libsForQt5.ffmpegthumbs + libsForQt5.gwenview + libsForQt5.kalendar + libsForQt5.kate + libsForQt5.kcalc + libsForQt5.kcharselect + libsForQt5.kcolorpicker + libsForQt5.kdenetwork-filesharing + libsForQt5.kdegraphics-thumbnailers + libsForQt5.kfind + libsForQt5.kgpg + libsForQt5.kmail + libsForQt5.kompare # Can't be used as git merge tool, but more integrated than kdiff3 + libsForQt5.ksystemlog + libsForQt5.kwallet # TODO: How does this integrate with hyprland? + libsForQt5.kwalletmanager # TODO: Same as above + libsForQt5.kwrited + libsForQt5.okular + libsForQt5.plasma-systemmonitor + libsForQt5.polkit-kde-agent + libsForQt5.spectacle + libsForQt5.skanlite + + slurp # Region selector for screensharing + ]; + + programs = { + rofi = { + enable = true; + package = pkgs.rofi-wayland; + plugins = [ + pkgs.keepmenu # Rofi KeepassXC frontend + ]; + terminal = "${pkgs.kitty}/bin/kitty"; + + font = "JetBrains Mono 14"; + # theme = + # extraConfig = ''''; + }; + + waybar = { + enable = true; + systemd = { + enable = false; + }; + + # settings = {}; + # style = ''''; + }; + }; + + services = { + # Notification service + dunst = { + enable = true; + }; + }; + + # Polkit + home.file.".config/hypr/polkit.conf".text = ''exec-once = ${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-agent-1 &''; + }; +} diff --git a/system/default.nix b/system/default.nix index 3d859f6d..6bd146e9 100644 --- a/system/default.nix +++ b/system/default.nix @@ -172,7 +172,7 @@ enable = true; extraPortals = with pkgs; [ # xdg-desktop-portal-wlr # For wlroots based desktops - xdg-desktop-portal-hyprland + # xdg-desktop-portal-hyprland # Already enabled by hyprland system module # xdg-desktop-portal-kde # xdg-desktop-portal-gtk # TODO: Keep for GTK apps? E.g. for font antialiasing? # xdg-desktop-portal-gnome # Gnome