From c1456cc4ba3c9485e7b4158c909eeca5a752cd59 Mon Sep 17 00:00:00 2001 From: Renato Biancalana da Silva Date: Thu, 21 May 2026 17:46:31 +0200 Subject: [PATCH] hyprland: support lua configType (#2316) Link: https://github.com/nix-community/stylix/pull/2316 Closes: https://github.com/nix-community/stylix/issues/2315 Reviewed-by: 0xda157 --- flake.lock | 6 +-- flake/dev/flake.lock | 34 ++++--------- generated/all-maintainers.nix | 3 -- modules/hyprland/hm.nix | 46 +++++++++++------- modules/hyprland/testbeds/hyprland-lua.nix | 12 +++++ modules/hyprland/testbeds/hyprland.nix | 8 +++- modules/kde/testbeds/kde.nix | 1 - .../graphical-environments/hyprland.nix | 48 ++++++++++++++----- 8 files changed, 96 insertions(+), 62 deletions(-) create mode 100644 modules/hyprland/testbeds/hyprland-lua.nix diff --git a/flake.lock b/flake.lock index d1e5c221..5a944519 100644 --- a/flake.lock +++ b/flake.lock @@ -139,11 +139,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1777268161, - "narHash": "sha256-bxrdOn8SCOv8tN4JbTF/TXq7kjo9ag4M+C8yzzIRYbE=", + "lastModified": 1778869304, + "narHash": "sha256-30sZNZoA1cqF5JNO9fVX+wgiQYjB7HJqqJ4ztCDeBZE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1c3fe55ad329cbcb28471bb30f05c9827f724c76", + "rev": "d233902339c02a9c334e7e593de68855ad26c4cb", "type": "github" }, "original": { diff --git a/flake/dev/flake.lock b/flake/dev/flake.lock index 2eda8a07..bca60cb8 100644 --- a/flake/dev/flake.lock +++ b/flake/dev/flake.lock @@ -2,7 +2,9 @@ "nodes": { "dankMaterialShell": { "inputs": { - "flake-compat": "flake-compat", + "flake-compat": [ + "flake-compat" + ], "nixpkgs": [ "dev-nixpkgs" ], @@ -44,11 +46,11 @@ }, "dev-nixpkgs": { "locked": { - "lastModified": 1777268161, - "narHash": "sha256-bxrdOn8SCOv8tN4JbTF/TXq7kjo9ag4M+C8yzzIRYbE=", + "lastModified": 1778869304, + "narHash": "sha256-30sZNZoA1cqF5JNO9fVX+wgiQYjB7HJqqJ4ztCDeBZE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1c3fe55ad329cbcb28471bb30f05c9827f724c76", + "rev": "d233902339c02a9c334e7e593de68855ad26c4cb", "type": "github" }, "original": { @@ -74,22 +76,6 @@ } }, "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1767039857, - "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", - "owner": "NixOS", - "repo": "flake-compat", - "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_2": { "locked": { "lastModified": 1767039857, "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", @@ -135,11 +121,11 @@ ] }, "locked": { - "lastModified": 1777594677, - "narHash": "sha256-h90sHwoRJLRvaTpZroTvU2JRHDFj0czUafM8eqLe1RI=", + "lastModified": 1778805320, + "narHash": "sha256-nGFJ01m2CTBKD4ABtcY4vLhHrRN91LKr/pn41PcU78A=", "owner": "nix-community", "repo": "home-manager", - "rev": "899c08a15beae5da51a5cecd6b2b994777a948da", + "rev": "9846abe15e7d0d36b8acbd4d05f2b87461744c92", "type": "github" }, "original": { @@ -316,7 +302,7 @@ "dev-flake-parts": "dev-flake-parts", "dev-nixpkgs": "dev-nixpkgs", "dev-systems": "dev-systems", - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat", "git-hooks": "git-hooks", "home-manager": "home-manager", "nixvim": "nixvim", diff --git a/generated/all-maintainers.nix b/generated/all-maintainers.nix index da357550..14e9272f 100644 --- a/generated/all-maintainers.nix +++ b/generated/all-maintainers.nix @@ -189,9 +189,6 @@ email = "nukdokplex@nukdokplex.ru"; github = "nukdokplex"; githubId = 25458915; - keys = [ - { fingerprint = "7CE2 4C42 942D 58EA 99F6 F00A A47E 7374 3EF6 FCC4"; } - ]; name = "Viktor Titov"; }; omega-800 = { diff --git a/modules/hyprland/hm.nix b/modules/hyprland/hm.nix index 1a7e1e00..e2010702 100644 --- a/modules/hyprland/hm.nix +++ b/modules/hyprland/hm.nix @@ -23,26 +23,32 @@ mkTarget { let rgb = color: "rgb(${color})"; rgba = color: alpha: "rgba(${color}${alpha})"; - in - { - decoration.shadow.color = rgba colors.base00 "99"; - general = { - "col.active_border" = rgb colors.base0D; - "col.inactive_border" = rgb colors.base03; - }; - group = { - "col.border_inactive" = rgb colors.base03; - "col.border_active" = rgb colors.base0D; - "col.border_locked_active" = rgb colors.base0C; + colorSettings = { + decoration.shadow.color = rgba colors.base00 "99"; - groupbar = { - text_color = rgb colors.base05; - "col.active" = rgb colors.base0D; - "col.inactive" = rgb colors.base03; + general = { + "col.active_border" = rgb colors.base0D; + "col.inactive_border" = rgb colors.base03; }; + + group = { + "col.border_inactive" = rgb colors.base03; + "col.border_active" = rgb colors.base0D; + "col.border_locked_active" = rgb colors.base0C; + + groupbar = { + text_color = rgb colors.base05; + "col.active" = rgb colors.base0D; + "col.inactive" = rgb colors.base03; + }; + }; + misc.background_color = rgb colors.base00; }; - misc.background_color = rgb colors.base00; - }; + in + if config.wayland.windowManager.hyprland.configType == "hyprlang" then + colorSettings + else + { config = colorSettings; }; } ) ( @@ -51,7 +57,11 @@ mkTarget { { services.hyprpaper.enable = true; stylix.targets.hyprpaper.enable = true; - wayland.windowManager.hyprland.settings.misc.disable_hyprland_logo = true; + wayland.windowManager.hyprland.settings = + if config.wayland.windowManager.hyprland.configType == "hyprlang" then + { misc.disable_hyprland_logo = true; } + else + { config.misc.disable_hyprland_logo = true; }; } ) ]; diff --git a/modules/hyprland/testbeds/hyprland-lua.nix b/modules/hyprland/testbeds/hyprland-lua.nix new file mode 100644 index 00000000..fd828867 --- /dev/null +++ b/modules/hyprland/testbeds/hyprland-lua.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: +{ + stylix.testbed.ui = { + graphicalEnvironment = "hyprland"; + + # We need something to open a window so that we can check the window borders + application = { + name = "kitty"; + package = pkgs.kitty; + }; + }; +} diff --git a/modules/hyprland/testbeds/hyprland.nix b/modules/hyprland/testbeds/hyprland.nix index fd828867..a5b17b2c 100644 --- a/modules/hyprland/testbeds/hyprland.nix +++ b/modules/hyprland/testbeds/hyprland.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: { stylix.testbed.ui = { graphicalEnvironment = "hyprland"; @@ -9,4 +9,10 @@ package = pkgs.kitty; }; }; + + home-manager.sharedModules = lib.singleton { + wayland.windowManager.hyprland = { + configType = "hyprlang"; + }; + }; } diff --git a/modules/kde/testbeds/kde.nix b/modules/kde/testbeds/kde.nix index 09e872bc..3e005151 100644 --- a/modules/kde/testbeds/kde.nix +++ b/modules/kde/testbeds/kde.nix @@ -13,7 +13,6 @@ }; home.packages = with pkgs; [ darkly - darkly-qt5 utterly-round-plasma-style ]; }; diff --git a/stylix/testbed/graphical-environments/hyprland.nix b/stylix/testbed/graphical-environments/hyprland.nix index 84d4c1cf..89b15e01 100644 --- a/stylix/testbed/graphical-environments/hyprland.nix +++ b/stylix/testbed/graphical-environments/hyprland.nix @@ -15,18 +15,42 @@ (pkgs.writeShellScriptBin "x-terminal-emulator" ''exec ${lib.getExe pkgs.kitty} "$@"'') ]; - home-manager.sharedModules = lib.singleton { - programs.kitty.enable = true; - wayland.windowManager.hyprland = { - enable = true; - settings = { - exec-once = "find /run/current-system/sw/etc/xdg/autostart/ -type f -or -type l | xargs -P0 -L1 ${lib.getExe pkgs.dex}"; - ecosystem = { - no_update_news = true; - no_donation_nag = true; - }; + home-manager.sharedModules = lib.singleton ( + { config, ... }: + { + programs.kitty.enable = true; + wayland.windowManager.hyprland = { + enable = true; + settings = + if config.wayland.windowManager.hyprland.configType == "hyprlang" then + { + exec-once = "find /run/current-system/sw/etc/xdg/autostart/ -type f -or -type l | xargs -P0 -L1 ${lib.getExe pkgs.dex}"; + ecosystem = { + no_update_news = true; + no_donation_nag = true; + }; + } + else + { + on = { + _args = [ + "hyprland.start" + (lib.generators.mkLuaInline '' + function() + hl.exec_cmd("find /run/current-system/sw/etc/xdg/autostart/ -type f -or -type l | xargs -P0 -L1 ${lib.getExe pkgs.dex}") + end + '') + ]; + }; + config = { + ecosystem = { + no_update_news = true; + no_donation_nag = true; + }; + }; + }; }; - }; - }; + } + ); }; }