Files
nixpkgs/pkgs/development/python-modules/hyprland-config/default.nix
Austin Horstman 25a2f89ee3 python3Packages.hyprland-config: use Lua 5.5
Hyprland 0.55+ configs are evaluated by Hyprland's embedded Lua, which
nixpkgs builds against lua5_5. load_lua() runs the user's config through
a standalone interpreter, so pinning it to 5.4 meant reading configs with
a different Lua than Hyprland itself uses.

Upstream already probes for lua5.5 first among the versioned names [1],
documents Lua 5.3+ as the requirement [2], and the HYPRLAND_CONFIG_LUA
override is still checked before the patched candidate list [1].

[1] 83a8981910/src/hyprland_config/_lua/_read/_runner.py (L29-L41)
[2] 83a8981910/README.md (L23)

Assisted-by: Claude (Opus 5.5)
Assisted-by: Codex (GPT-6.1-sol)
2026-10-06 13:50:22 -05:00

51 lines
1.5 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
hatchling,
hypothesis,
lua5_5,
pytestCheckHook,
}:
buildPythonPackage (finalAttrs: {
pname = "hyprland-config";
version = "0.9.18";
pyproject = true;
src = fetchFromGitHub {
owner = "BlueManCZ";
repo = "hyprland-config";
tag = "v${finalAttrs.version}";
hash = "sha256-SL7ZZWraRpkDNR9jE4DZx6arFRdRnjZKYfFHdZrEeZQ=";
};
# The Lua reader shells out to an interpreter it looks up on PATH at runtime.
# Hyprland links Lua internally and never installs a `lua` binary, so without
# this every read of a Lua-mode config raises LuaReaderError.
postPatch = ''
substituteInPlace src/hyprland_config/_lua/_read/_runner.py \
--replace-fail '_LUA_BINARY_CANDIDATES = ("lua", "lua5.5", "lua5.4", "lua5.3", "lua5.2")' \
'_LUA_BINARY_CANDIDATES = ("${lib.getExe lua5_5}",)'
'';
build-system = [ hatchling ];
nativeCheckInputs = [
hypothesis
lua5_5 # the test helpers probe PATH for lua/luac themselves
pytestCheckHook
];
pythonImportsCheck = [ "hyprland_config" ];
meta = {
description = "Round-trip parser and editor for Hyprland configuration files";
homepage = "https://github.com/BlueManCZ/hyprland-config";
changelog = "https://github.com/BlueManCZ/hyprland-config/releases/tag/v${finalAttrs.version}";
license = lib.licenses.mit;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ sophronesis ];
};
})