Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 179 lines 4.4 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 ] ++ extraNativeBuildInputs; 76 77 buildInputs = 78 [ 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 primeos 134 synthetica 135 rewine 136 ]; 137 pkgConfigModules = [ 138 ( 139 if lib.versionOlder finalAttrs.version "0.18" then 140 "wlroots" 141 else 142 "wlroots-${lib.versions.majorMinor finalAttrs.version}" 143 ) 144 ]; 145 }; 146 }); 147 148in 149rec { 150 wlroots_0_17 = generic { 151 version = "0.17.4"; 152 hash = "sha256-AzmXf+HMX/6VAr0LpfHwfmDB9dRrrLQHt7l35K98MVo="; 153 patches = [ 154 (fetchpatch { 155 # SIGCHLD here isn't fatal: we have other means of notifying that things were 156 # successful or failure, and it causes many compositors to have to do a bunch 157 # of extra work: https://github.com/qtile/qtile/issues/5101 158 url = "https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/631e5be0d7a7e4c7086b9778bc8fac809f96d336.patch"; 159 hash = "sha256-3Jnx4ZeKc3+NxraK2T7nZ2ibtWJuTEFmxa976fjAqsM="; 160 }) 161 ]; 162 }; 163 164 wlroots_0_18 = generic { 165 version = "0.18.2"; 166 hash = "sha256-vKvMWRPPJ4PRKWVjmKKCdNSiqsQm+uQBoBnBUFElLNA="; 167 extraBuildInputs = [ 168 lcms2 169 ]; 170 }; 171 172 wlroots_0_19 = generic { 173 version = "0.19.0"; 174 hash = "sha256-I8z50yA/ukvXEC5TksG84+GrQpfC4drBJDRGw0R8RLk="; 175 extraBuildInputs = [ 176 lcms2 177 ]; 178 }; 179}