From 40d457f6a1ae9a34e4a369eaf7219cfc0effddb1 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Mon, 8 Dec 2025 18:53:30 +0200 Subject: [PATCH] feat: hyprland and friends --- modules/home/hypridle.nix | 15 +++ modules/hyprland.nix | 187 ++++++++++++++++++++++++++++++++++++++ modules/hyprlock.nix | 39 ++++++++ 3 files changed, 241 insertions(+) create mode 100644 modules/home/hypridle.nix create mode 100644 modules/hyprland.nix create mode 100644 modules/hyprlock.nix diff --git a/modules/home/hypridle.nix b/modules/home/hypridle.nix new file mode 100644 index 0000000..2dc2864 --- /dev/null +++ b/modules/home/hypridle.nix @@ -0,0 +1,15 @@ +{ + flake.modules.homeManager.hypridle = {...}: { + services.hypridle = { + enable = true; + settings = { + general.lock_cmd = "hyprlock"; + listener = [ + { + timeout = 30; + } + ]; + }; + }; + }; +} diff --git a/modules/hyprland.nix b/modules/hyprland.nix new file mode 100644 index 0000000..304de96 --- /dev/null +++ b/modules/hyprland.nix @@ -0,0 +1,187 @@ +{ + config, + inputs, + ... +}: let + modulesHomeManager = config.flake.modules.homeManager; +in { + flake.modules.nixos.hyprland = {...}: { + imports = with config.flake.modules.nixos; + [ + hyprlock + ] + ++ [config.flake.modules.nixos.groupCompositor]; + + programs.hyprland.enable = true; + }; + + flake.modules.homeManager.hyprland = { + config, + lib, + pkgs, + ... + }: let + cfg = config.arta.hyprland; + in { + imports = with modulesHomeManager; + [ + hyprlock + hypridle + ] + ++ [ + modulesHomeManager.groupCompositor + + inputs.hyprcursor-phinger.homeManagerModules.hyprcursor-phinger + ]; + + options.arta.hyprland = { + extraConfig = lib.mkOption { + type = lib.types.lazyAttrsOf lib.types.unspecified; + default = {}; + }; + }; + + config = { + programs.hyprcursor-phinger.enable = true; + home.pointerCursor = { + package = pkgs.phinger-cursors; + name = "phinger-cursors-light"; + size = 24; + gtk.enable = true; + }; + + wayland.windowManager.hyprland = { + enable = true; + package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; + portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland; + plugins = [ + inputs.hy3.packages.${pkgs.stdenv.hostPlatform.system}.hy3 + ]; + settings = lib.mkMerge [ + { + input = { + kb_layout = "us,fi,no"; + kb_options = "grp:win_space_toggle,ctrl:nocaps"; + touchpad = { + disable_while_typing = false; + }; + }; + + misc = { + middle_click_paste = false; + }; + + ecosystem = { + no_update_news = true; + no_donation_nag = true; + }; + + general.layout = "hy3"; + + plugin = { + hy3 = { + tabs = { + height = 8; + padding = 4; + radius = 0; + border_width = 4; + render_text = false; + "col.active" = "0xff7298bf"; + "col.active.border" = "0xff7298bf"; + "col.inactive" = "0xff3f546a"; + "col.inactive.border" = "0xff3f546a"; + blur = false; + }; + }; + }; + + # Style + general = { + border_size = 4; + gaps_in = 4; + gaps_out = 8; + "col.active_border" = "0xff7298bf"; + "col.inactive_border" = "0xff3f546a"; + }; + + decoration = { + shadow.enabled = false; + blur.enabled = false; + }; + + animations.enabled = false; + + misc = { + disable_hyprland_logo = true; + disable_splash_rendering = true; + }; + + # Binds + "$mod" = "SUPER"; + bind = + [ + "$mod, Return, exec, foot" + "$mod, d, exec, rofi -show run" + "$mod SHIFT, x, exec, hyprlock" + + "$mod SHIFT, w, exec, wpaperctl next" + + "$mod SHIFT, q, killactive" + + "$mod, f, fullscreen, 0" + "$mod SHIFT, space, togglefloating" + + "$mod, b, hy3:makegroup, h, toggle" + "$mod, v, hy3:makegroup, v, toggle" + "$mod, w, hy3:makegroup, tab" + + "$mod, h, hy3:movefocus, l" + "$mod, j, hy3:movefocus, d" + "$mod, k, hy3:movefocus, u" + "$mod, l, hy3:movefocus, r" + "$mod SHIFT, h, hy3:movewindow, l" + "$mod SHIFT, j, hy3:movewindow, d" + "$mod SHIFT, k, hy3:movewindow, u" + "$mod SHIFT, l, hy3:movewindow, r" + + "$mod, 1, workspace, 1" + "$mod, 2, workspace, 2" + "$mod, 3, workspace, 3" + "$mod, 4, workspace, 4" + "$mod, 5, workspace, 5" + "$mod, 6, workspace, 6" + "$mod, 7, workspace, 7" + "$mod, 8, workspace, 8" + "$mod, 9, workspace, 9" + "$mod SHIFT, 1, movetoworkspace, 1" + "$mod SHIFT, 2, movetoworkspace, 2" + "$mod SHIFT, 3, movetoworkspace, 3" + "$mod SHIFT, 4, movetoworkspace, 4" + "$mod SHIFT, 5, movetoworkspace, 5" + "$mod SHIFT, 6, movetoworkspace, 6" + "$mod SHIFT, 7, movetoworkspace, 7" + "$mod SHIFT, 8, movetoworkspace, 8" + "$mod SHIFT, 9, movetoworkspace, 9" + ] + ++ [ + # TODO: maybe make a separate module "hyprlandPassmenu" that adds this + "$mod, p, exec, passmenu" + ]; + binde = [ + "$mod CTRL, h, resizeactive, -10 0" + "$mod CTRL, j, resizeactive, 0 -10" + "$mod CTRL, k, resizeactive, 0 10" + "$mod CTRL, l, resizeactive, 10 0" + ]; + + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + } + cfg.extraConfig + ]; + }; + }; + }; +} diff --git a/modules/hyprlock.nix b/modules/hyprlock.nix new file mode 100644 index 0000000..9873394 --- /dev/null +++ b/modules/hyprlock.nix @@ -0,0 +1,39 @@ +{ + flake.modules.nixos.hyprlock = {...}: { + security.pam.services.hyprlock = {}; + }; + + flake.modules.homeManager.hyprlock = { + config, + lib, + ... + }: let + cfg = config.arta.hyprlock; + in { + options.arta.hyprlock = { + extraConfig = lib.mkOption { + type = lib.types.lazyAttrsOf lib.types.unspecified; + default = {}; + }; + }; + + config = { + programs.hyprlock = { + enable = true; + settings = lib.mkMerge [ + { + general = { + hide_cursor = true; + ignore_empty_input = true; + }; + animations.enabled = false; + background = { + color = "0xffffffff"; + }; + } + cfg.extraConfig + ]; + }; + }; + }; +} -- 2.44.1