43 enableXWayland ? true,
44 legacyRenderer ? false,
45 withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd,
46 wrapRuntimeDeps ? true,
48 nvidiaPatches ? false,
49 hidpiXWayland ? false,
50 enableNvidiaPatches ? false,
56 inherit (lib.asserts) assertMsg;
57 inherit (lib.attrsets) mapAttrsToList;
72 info = importJSON ./info.json;
74 # possibility to add more adapters in the future, such as keepDebugInfo,
75 # which would be controlled by the `debug` flag
77 stdenvAdapters.useMoldLinker
80 customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters;
82 assert assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed.";
83 assert assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed.";
84 assert assertMsg (!hidpiXWayland)
85 "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland";
87 customStdenv.mkDerivation (finalAttrs: {
88 pname = "hyprland" + optionalString debug "-debug";
91 src = fetchFromGitHub {
94 fetchSubmodules = true;
95 tag = "v${finalAttrs.version}";
96 hash = "sha256-dSKR1VpjpdJVZ5dmLgIvAu3K+DYrSbohZkqxSQhjw8U=";
100 # Fix hardcoded paths to /usr installation
101 sed -i "s#/usr#$out#" src/render/OpenGL.cpp
103 # Remove extra @PREFIX@ to fix pkg-config paths
104 sed -i "s#@PREFIX@/##g" hyprland.pc.in
106 substituteInPlace protocols/meson.build --replace-fail \
107 "wayland_scanner = dependency('wayland-scanner')" \
108 "wayland_scanner = dependency('wayland-scanner', native: true)"
111 # variables used by generateVersion.sh script, and shown in `hyprctl version`
112 BRANCH = info.branch;
113 COMMITS = info.commit_hash;
116 HASH = info.commit_hash;
117 MESSAGE = info.commit_message;
121 # to find wayland-scanner when cross-compiling
125 nativeBuildInputs = [
143 buildInputs = concatLists [
167 (optionals customStdenv.hostPlatform.isBSD [ epoll-shim ])
168 (optionals customStdenv.hostPlatform.isMusl [ libexecinfo ])
169 (optionals enableXWayland [
176 (optionals withSystemd [ systemd ])
179 mesonBuildType = if debug then "debugoptimized" else "release";
184 mesonFlags = concatLists [
185 (mapAttrsToList mesonEnable {
186 "xwayland" = enableXWayland;
187 "legacy_renderer" = legacyRenderer;
188 "systemd" = withSystemd;
190 (mapAttrsToList mesonBool {
191 # PCH provides no benefits when building with Nix
193 "tracy_enable" = false;
198 ${optionalString wrapRuntimeDeps ''
199 wrapProgram $out/bin/Hyprland \
212 providedSessions = [ "hyprland" ];
213 updateScript = ./update.sh;
217 homepage = "https://github.com/hyprwm/Hyprland";
218 description = "Dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
219 license = lib.licenses.bsd3;
220 maintainers = lib.teams.hyprland.members;
221 mainProgram = "Hyprland";
222 platforms = lib.platforms.linux ++ lib.platforms.freebsd;