Merge pull request #329823 from ExpidusOS/fix/pkgsllvm/elfutils
[NixPkgs.git] / pkgs / by-name / hy / hyprland / package.nix
blob2f3d5f7e6327af5d9e5b3f548031e4fd13ef37fb
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , pkg-config
5 , makeWrapper
6 , meson
7 , cmake
8 , ninja
9 , binutils
10 , cairo
11 , epoll-shim
12 , expat
13 , fribidi
14 , git
15 , hyprcursor
16 , hyprland-protocols
17 , hyprlang
18 , hyprutils
19 , hyprwayland-scanner
20 , jq
21 , libGL
22 , libdrm
23 , libdatrie
24 , libexecinfo
25 , libinput
26 , libselinux
27 , libsepol
28 , libthai
29 , libuuid
30 , libxkbcommon
31 , mesa
32 , pango
33 , pciutils
34 , pcre2
35 , pkgconf
36 , python3
37 , systemd
38 , tomlplusplus
39 , wayland
40 , wayland-protocols
41 , wayland-scanner
42 , xwayland
43 , hwdata
44 , seatd
45 , libdisplay-info
46 , libliftoff
47 , xorg
48 , debug ? false
49 , enableXWayland ? true
50 , legacyRenderer ? false
51 , withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
52 , wrapRuntimeDeps ? true
53   # deprecated flags
54 , nvidiaPatches ? false
55 , hidpiXWayland ? false
56 , enableNvidiaPatches ? false
58 let
59   info = builtins.fromJSON (builtins.readFile ./info.json);
61 assert lib.assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed.";
62 assert lib.assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed.";
63 assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland";
65 stdenv.mkDerivation (finalAttrs: {
66   pname = "hyprland" + lib.optionalString debug "-debug";
67   version = "0.41.2";
69   src = fetchFromGitHub {
70     owner = "hyprwm";
71     repo = "hyprland";
72     fetchSubmodules = true;
73     rev = "refs/tags/v${finalAttrs.version}";
74     hash = "sha256-JmfnYz+9a4TjNl3mAus1VpoWtTI9d1xkW9MHbkcV0Po=";
75   };
77   postPatch = ''
78     # Fix hardcoded paths to /usr installation
79     sed -i "s#/usr#$out#" src/render/OpenGL.cpp
81     # Remove extra @PREFIX@ to fix pkg-config paths
82     sed -i "s#@PREFIX@/##g" hyprland.pc.in
83   '';
85   # variables used by generateVersion.sh script, and shown in `hyprctl version`
86   BRANCH = info.branch;
87   COMMITS = info.commit_hash;
88   DATE = info.date;
89   DIRTY = "";
90   HASH = info.commit_hash;
91   MESSAGE = info.commit_message;
92   TAG = info.tag;
94   depsBuildBuild = [
95     # to find wayland-scanner when cross-compiling
96     pkg-config
97   ];
99   nativeBuildInputs = [
100     hwdata
101     hyprwayland-scanner
102     jq
103     makeWrapper
104     cmake
105     meson # for wlroots
106     ninja
107     pkg-config
108     wayland-scanner
109     python3 # for udis86
110   ];
112   outputs = [
113     "out"
114     "man"
115     "dev"
116   ];
118   buildInputs = [
119     cairo
120     expat
121     fribidi
122     git
123     hyprcursor.dev
124     hyprland-protocols
125     hyprlang
126     hyprutils
127     libGL
128     libdatrie
129     libdrm
130     libinput
131     libselinux
132     libsepol
133     libthai
134     libuuid
135     libxkbcommon
136     mesa
137     wayland
138     wayland-protocols
139     pango
140     pciutils
141     pcre2
142     tomlplusplus
143     # for subproject wlroots-hyprland
144     seatd
145     libliftoff
146     libdisplay-info
147     xorg.xcbutilerrors
148     xorg.xcbutilrenderutil
149   ]
150   ++ lib.optionals stdenv.hostPlatform.isBSD [ epoll-shim ]
151   ++ lib.optionals stdenv.hostPlatform.isMusl [ libexecinfo ]
152   ++ lib.optionals enableXWayland [
153     xorg.libxcb
154     xorg.libXdmcp
155     xorg.xcbutil
156     xorg.xcbutilwm
157     xwayland
158   ]
159   ++ lib.optionals withSystemd [ systemd ];
161   cmakeBuildType =
162     if debug
163     then "Debug"
164     else "RelWithDebInfo";
167   cmakeFlags = [
168     (lib.cmakeBool "NO_XWAYLAND" (!enableXWayland))
169     (lib.cmakeBool "LEGACY_RENDERER" legacyRenderer)
170     (lib.cmakeBool "NO_SYSTEMD" (!withSystemd))
171   ];
173   postInstall = ''
174     ${lib.optionalString wrapRuntimeDeps ''
175       wrapProgram $out/bin/Hyprland \
176         --suffix PATH : ${lib.makeBinPath [binutils pciutils pkgconf]}
177     ''}
178   '';
180   passthru.providedSessions = [ "hyprland" ];
182   passthru.updateScript = ./update.sh;
184   meta = {
185     homepage = "https://github.com/hyprwm/Hyprland";
186     description = "Dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
187     license = lib.licenses.bsd3;
188     maintainers = with lib.maintainers; [
189       fufexan
190       johnrtitor
191       wozeparrot
192     ];
193     mainProgram = "Hyprland";
194     platforms = lib.platforms.linux;
195   };