39 enableXWayland ? true,
40 legacyRenderer ? false,
41 withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd,
42 wrapRuntimeDeps ? true,
44 nvidiaPatches ? false,
45 hidpiXWayland ? false,
46 enableNvidiaPatches ? false,
52 inherit (lib.asserts) assertMsg;
53 inherit (lib.attrsets) mapAttrsToList;
68 info = importJSON ./info.json;
70 # possibility to add more adapters in the future, such as keepDebugInfo,
71 # which would be controlled by the `debug` flag
73 stdenvAdapters.useMoldLinker
76 customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters;
78 assert assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed.";
79 assert assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed.";
80 assert assertMsg (!hidpiXWayland)
81 "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland";
83 customStdenv.mkDerivation (finalAttrs: {
84 pname = "hyprland" + optionalString debug "-debug";
87 src = fetchFromGitHub {
90 fetchSubmodules = true;
91 rev = "refs/tags/v${finalAttrs.version}";
92 hash = "sha256-//Ib7gXCA8jq8c+QGTTIO0oH0rUYYBXGp8sqpI1jlhA=";
96 # Fix hardcoded paths to /usr installation
97 sed -i "s#/usr#$out#" src/render/OpenGL.cpp
99 # Remove extra @PREFIX@ to fix pkg-config paths
100 sed -i "s#@PREFIX@/##g" hyprland.pc.in
103 # variables used by generateVersion.sh script, and shown in `hyprctl version`
104 BRANCH = info.branch;
105 COMMITS = info.commit_hash;
108 HASH = info.commit_hash;
109 MESSAGE = info.commit_message;
113 # to find wayland-scanner when cross-compiling
117 nativeBuildInputs = [
135 buildInputs = concatLists [
156 (optionals customStdenv.hostPlatform.isBSD [ epoll-shim ])
157 (optionals customStdenv.hostPlatform.isMusl [ libexecinfo ])
158 (optionals enableXWayland [
165 (optionals withSystemd [ systemd ])
168 mesonBuildType = if debug then "debugoptimized" else "release";
172 mesonFlags = concatLists [
173 (mapAttrsToList mesonEnable {
174 "xwayland" = enableXWayland;
175 "legacy_renderer" = legacyRenderer;
176 "systemd" = withSystemd;
178 (mapAttrsToList mesonBool {
179 # PCH provides no benefits when building with Nix
181 "tracy_enable" = false;
186 ${optionalString wrapRuntimeDeps ''
187 wrapProgram $out/bin/Hyprland \
199 providedSessions = [ "hyprland" ];
200 updateScript = ./update.sh;
204 homepage = "https://github.com/hyprwm/Hyprland";
205 description = "Dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
206 license = lib.licenses.bsd3;
207 maintainers = with lib.maintainers; [
213 mainProgram = "Hyprland";
214 platforms = lib.platforms.linux ++ lib.platforms.freebsd;