at master 178 lines 4.3 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitLab, 5 fetchpatch, 6 meson, 7 ninja, 8 pkg-config, 9 wayland-scanner, 10 libGL, 11 wayland, 12 wayland-protocols, 13 libinput, 14 libxkbcommon, 15 pixman, 16 libcap, 17 libgbm, 18 xorg, 19 hwdata, 20 seatd, 21 vulkan-loader, 22 glslang, 23 libliftoff, 24 libdisplay-info, 25 lcms2, 26 nixosTests, 27 testers, 28 29 enableXWayland ? true, 30 xwayland ? null, 31}: 32 33let 34 generic = 35 { 36 version, 37 hash, 38 extraBuildInputs ? [ ], 39 extraNativeBuildInputs ? [ ], 40 patches ? [ ], 41 postPatch ? "", 42 }: 43 stdenv.mkDerivation (finalAttrs: { 44 pname = "wlroots"; 45 inherit version; 46 47 inherit enableXWayland; 48 49 src = fetchFromGitLab { 50 domain = "gitlab.freedesktop.org"; 51 owner = "wlroots"; 52 repo = "wlroots"; 53 rev = finalAttrs.version; 54 inherit hash; 55 }; 56 57 inherit patches postPatch; 58 59 # $out for the library and $examples for the example programs (in examples): 60 outputs = [ 61 "out" 62 "examples" 63 ]; 64 65 strictDeps = true; 66 depsBuildBuild = [ pkg-config ]; 67 68 nativeBuildInputs = [ 69 meson 70 ninja 71 pkg-config 72 wayland-scanner 73 glslang 74 hwdata 75 ] 76 ++ extraNativeBuildInputs; 77 78 buildInputs = [ 79 libliftoff 80 libdisplay-info 81 libGL 82 libcap 83 libinput 84 libxkbcommon 85 libgbm 86 pixman 87 seatd 88 vulkan-loader 89 wayland 90 wayland-protocols 91 xorg.libX11 92 xorg.xcbutilerrors 93 xorg.xcbutilimage 94 xorg.xcbutilrenderutil 95 xorg.xcbutilwm 96 ] 97 ++ lib.optional finalAttrs.enableXWayland xwayland 98 ++ extraBuildInputs; 99 100 mesonFlags = lib.optional (!finalAttrs.enableXWayland) "-Dxwayland=disabled"; 101 102 postFixup = '' 103 # Install ALL example programs to $examples: 104 # screencopy dmabuf-capture input-inhibitor layer-shell idle-inhibit idle 105 # screenshot output-layout multi-pointer rotation tablet touch pointer 106 # simple 107 mkdir -p $examples/bin 108 cd ./examples 109 for binary in $(find . -executable -type f -printf '%P\n' | grep -vE '\.so'); do 110 cp "$binary" "$examples/bin/wlroots-$binary" 111 done 112 ''; 113 114 # Test via TinyWL (the "minimum viable product" Wayland compositor based on wlroots): 115 passthru.tests = { 116 tinywl = nixosTests.tinywl; 117 pkg-config = testers.hasPkgConfigModules { 118 package = finalAttrs.finalPackage; 119 }; 120 }; 121 122 meta = { 123 description = "Modular Wayland compositor library"; 124 longDescription = '' 125 Pluggable, composable, unopinionated modules for building a Wayland 126 compositor; or about 50,000 lines of code you were going to write anyway. 127 ''; 128 inherit (finalAttrs.src.meta) homepage; 129 changelog = "https://gitlab.freedesktop.org/wlroots/wlroots/-/tags/${version}"; 130 license = lib.licenses.mit; 131 platforms = lib.platforms.linux; 132 maintainers = with lib.maintainers; [ 133 synthetica 134 wineee 135 ]; 136 pkgConfigModules = [ 137 ( 138 if lib.versionOlder finalAttrs.version "0.18" then 139 "wlroots" 140 else 141 "wlroots-${lib.versions.majorMinor finalAttrs.version}" 142 ) 143 ]; 144 }; 145 }); 146 147in 148rec { 149 wlroots_0_17 = generic { 150 version = "0.17.4"; 151 hash = "sha256-AzmXf+HMX/6VAr0LpfHwfmDB9dRrrLQHt7l35K98MVo="; 152 patches = [ 153 (fetchpatch { 154 # SIGCHLD here isn't fatal: we have other means of notifying that things were 155 # successful or failure, and it causes many compositors to have to do a bunch 156 # of extra work: https://github.com/qtile/qtile/issues/5101 157 url = "https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/631e5be0d7a7e4c7086b9778bc8fac809f96d336.patch"; 158 hash = "sha256-3Jnx4ZeKc3+NxraK2T7nZ2ibtWJuTEFmxa976fjAqsM="; 159 }) 160 ]; 161 }; 162 163 wlroots_0_18 = generic { 164 version = "0.18.2"; 165 hash = "sha256-vKvMWRPPJ4PRKWVjmKKCdNSiqsQm+uQBoBnBUFElLNA="; 166 extraBuildInputs = [ 167 lcms2 168 ]; 169 }; 170 171 wlroots_0_19 = generic { 172 version = "0.19.1"; 173 hash = "sha256-Q4x6obwzYYncgoUzqFVzn/scjxsiUeAIlEWY43emdvA="; 174 extraBuildInputs = [ 175 lcms2 176 ]; 177 }; 178}