diff --git a/modules/services/window-managers/hyprland.nix b/modules/services/window-managers/hyprland.nix index 7aaddcfa4..1cddd7339 100644 --- a/modules/services/window-managers/hyprland.nix +++ b/modules/services/window-managers/hyprland.nix @@ -480,6 +480,14 @@ in ); xdg.configFile = lib.mkMerge [ + { + "hypr/.luarc.json" = lib.mkIf (cfg.configType == "lua" && cfg.finalPackage != null) { + text = builtins.toJSON { + workspace.library = [ "${cfg.finalPackage}/share/hypr/stubs" ]; + diagnostics.globals = [ "hl" ]; + }; + }; + } { "hypr/hyprland.conf" = lib.mkIf (cfg.configType == "hyprlang") ( let diff --git a/tests/modules/services/hyprland/lua-config.nix b/tests/modules/services/hyprland/lua-config.nix index 1b6a1403e..a585a98d9 100644 --- a/tests/modules/services/hyprland/lua-config.nix +++ b/tests/modules/services/hyprland/lua-config.nix @@ -1,10 +1,16 @@ { config, lib, ... }: +let + hyprland = config.lib.test.mkStubPackage { name = "hyprland"; }; +in + { wayland.windowManager.hyprland = { enable = true; configType = "lua"; - package = null; + package = hyprland // { + override = _: hyprland; + }; portalPackage = null; plugins = [ @@ -200,10 +206,14 @@ nmt.script = '' config=home-files/.config/hypr/hyprland.lua + luarc=home-files/.config/hypr/.luarc.json assertFileExists "$config" + assertFileExists "$luarc" assertPathNotExists home-files/.config/hypr/hyprland.conf assertFileNotRegex "$config" "ignored-hyprlang-bind" normalizedConfig=$(normalizeStorePaths "$config") + normalizedLuarc=$(normalizeStorePaths "$luarc") assertFileContent "$normalizedConfig" ${./lua-config.lua} + assertFileContent "$normalizedLuarc" ${./luarc.json} ''; } diff --git a/tests/modules/services/hyprland/luarc.json b/tests/modules/services/hyprland/luarc.json new file mode 100644 index 000000000..19aef8561 --- /dev/null +++ b/tests/modules/services/hyprland/luarc.json @@ -0,0 +1 @@ +{"diagnostics":{"globals":["hl"]},"workspace":{"library":["/nix/store/00000000000000000000000000000000-hyprland/share/hypr/stubs"]}} \ No newline at end of file