Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 243 lines 6.2 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 nixosTests, 6 testers, 7 cmake, 8 pkg-config, 9 python3, 10 boost, 11 egl-wayland, 12 freetype, 13 glib, 14 glm, 15 libapparmor, 16 libdrm, 17 libepoxy, 18 libevdev, 19 libglvnd, 20 libinput, 21 libuuid, 22 libxcb, 23 libxkbcommon, 24 libxmlxx, 25 yaml-cpp, 26 lttng-ust, 27 libgbm, 28 nettle, 29 pixman, 30 udev, 31 wayland, 32 wayland-scanner, 33 xorg, 34 xwayland, 35 dbus, 36 gobject-introspection, 37 gtest, 38 umockdev, 39 wlcs, 40 validatePkgConfig, 41}: 42 43{ 44 version, 45 pinned ? false, 46 hash, 47 patches ? [ ], 48}: 49 50stdenv.mkDerivation (finalAttrs: { 51 pname = "mir"; 52 inherit version; 53 54 src = fetchFromGitHub { 55 owner = "canonical"; 56 repo = "mir"; 57 rev = "v${finalAttrs.version}"; 58 inherit hash; 59 }; 60 61 inherit patches; 62 63 postPatch = '' 64 # Fix scripts that get run in tests 65 patchShebangs tools/detect_fd_leaks.bash tests/acceptance-tests/wayland-generator/test_wayland_generator.sh.in 66 67 # Fix LD_PRELOADing in tests 68 substituteInPlace \ 69 cmake/MirCommon.cmake \ 70 tests/umock-acceptance-tests/CMakeLists.txt \ 71 tests/unit-tests/platforms/gbm-kms/kms/CMakeLists.txt \ 72 tests/unit-tests/CMakeLists.txt \ 73 --replace-warn 'LD_PRELOAD=liblttng-ust-fork.so' 'LD_PRELOAD=${lib.getLib lttng-ust}/lib/liblttng-ust-fork.so' \ 74 --replace-warn 'LD_PRELOAD=libumockdev-preload.so.0' 'LD_PRELOAD=${lib.getLib umockdev}/lib/libumockdev-preload.so.0' 75 76 # Fix Xwayland default 77 substituteInPlace src/miral/x11_support.cpp \ 78 --replace-fail '/usr/bin/Xwayland' '${lib.getExe xwayland}' 79 '' 80 + lib.optionalString (lib.strings.versionOlder version "2.18.0") '' 81 82 # Fix paths for generating drm-formats 83 substituteInPlace src/platform/graphics/CMakeLists.txt \ 84 --replace-fail "/usr/include/drm/drm_fourcc.h" "${lib.getDev libdrm}/include/libdrm/drm_fourcc.h" \ 85 --replace-fail "/usr/include/libdrm/drm_fourcc.h" "${lib.getDev libdrm}/include/libdrm/drm_fourcc.h" 86 ''; 87 88 strictDeps = true; 89 90 nativeBuildInputs = [ 91 cmake 92 glib # gdbus-codegen 93 lttng-ust # lttng-gen-tp 94 pkg-config 95 (python3.withPackages ( 96 ps: 97 with ps; 98 [ pillow ] 99 ++ lib.optionals finalAttrs.finalPackage.doCheck [ 100 pygobject3 101 python-dbusmock 102 ] 103 )) 104 validatePkgConfig 105 wayland-scanner 106 ]; 107 108 buildInputs = [ 109 boost 110 egl-wayland 111 freetype 112 glib 113 glm 114 libdrm 115 libepoxy 116 libevdev 117 libglvnd 118 libinput 119 libuuid 120 libxcb 121 libxkbcommon 122 libxmlxx 123 yaml-cpp 124 lttng-ust 125 libgbm 126 nettle 127 udev 128 wayland 129 xorg.libX11 130 xorg.libXcursor 131 xorg.xorgproto 132 xwayland 133 ] 134 ++ lib.optionals (lib.strings.versionAtLeast version "2.18.0") [ 135 libapparmor 136 ] 137 ++ lib.optionals (lib.strings.versionAtLeast version "2.21.0") [ 138 pixman 139 ]; 140 141 nativeCheckInputs = [ 142 dbus 143 gobject-introspection 144 ]; 145 146 checkInputs = [ 147 gtest 148 umockdev 149 wlcs 150 ]; 151 152 cmakeFlags = [ 153 (lib.cmakeBool "BUILD_DOXYGEN" false) 154 (lib.cmakeFeature "MIR_PLATFORM" ( 155 lib.strings.concatStringsSep ";" [ 156 "gbm-kms" 157 "x11" 158 "eglstream-kms" 159 "wayland" 160 ] 161 )) 162 (lib.cmakeBool "MIR_ENABLE_TESTS" finalAttrs.finalPackage.doCheck) 163 # BadBufferTest.test_truncated_shm_file *doesn't* throw an error as the test expected, mark as such 164 # https://github.com/canonical/mir/pull/1947#issuecomment-811810872 165 (lib.cmakeBool "MIR_SIGBUS_HANDLER_ENVIRONMENT_BROKEN" true) 166 (lib.cmakeFeature "MIR_EXCLUDE_TESTS" ( 167 lib.strings.concatStringsSep ";" [ 168 # https://github.com/canonical/mir/issues/3716#issuecomment-2580698552 169 "UdevWrapperTest.UdevMonitorDoesNotTriggerBeforeEnabling" 170 ] 171 )) 172 # These get built but don't get executed by default, yet they get installed when tests are enabled 173 (lib.cmakeBool "MIR_BUILD_PERFORMANCE_TESTS" false) 174 (lib.cmakeBool "MIR_BUILD_PLATFORM_TEST_HARNESS" false) 175 # https://github.com/canonical/mir/issues/2987 176 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106799 177 (lib.cmakeBool "MIR_USE_PRECOMPILED_HEADERS" false) 178 (lib.cmakeFeature "MIR_COMPILER_QUIRKS" ( 179 lib.strings.concatStringsSep ";" [ 180 # https://github.com/canonical/mir/issues/3017 actually affects x86_64 as well 181 "test_touchspot_controller.cpp:array-bounds" 182 ] 183 )) 184 ]; 185 186 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; 187 188 preCheck = '' 189 export XDG_RUNTIME_DIR=$TMP 190 ''; 191 192 outputs = [ 193 "out" 194 "dev" 195 ]; 196 197 passthru = { 198 tests = { 199 pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; 200 } 201 // lib.optionalAttrs (!pinned) { inherit (nixosTests) miriway miracle-wm; }; 202 providedSessions = lib.optionals (lib.strings.versionOlder version "2.16.0") [ 203 # More of an example than a fully functioning shell, some notes for the adventurous: 204 # - ~/.config/miral-shell.config is one possible user config location, 205 # accepted options=value are according to `mir-shell --help` 206 # - default icon theme setting is DMZ-White, needs vanilla-dmz installed & on XCURSOR_PATH 207 # or setting to be changed to an available theme 208 # - terminal emulator setting may need to be changed if miral-terminal script 209 # does not know about preferred terminal 210 "mir-shell" 211 ]; 212 } 213 // lib.optionalAttrs (!pinned) { updateScript = ./update.sh; }; 214 215 meta = { 216 description = "Display server and Wayland compositor developed by Canonical"; 217 homepage = "https://mir-server.io"; 218 changelog = "https://github.com/canonical/mir/releases/tag/v${finalAttrs.version}"; 219 license = lib.licenses.gpl2Plus; 220 maintainers = with lib.maintainers; [ 221 onny 222 OPNA2608 223 ]; 224 platforms = lib.platforms.linux; 225 pkgConfigModules = [ 226 "miral" 227 "mircommon" 228 "mircore" 229 "miroil" 230 "mirplatform" 231 "mir-renderer-gl-dev" 232 "mirrenderer" 233 "mirserver" 234 "mirtest" 235 "mirwayland" 236 ] 237 ++ lib.optionals (lib.strings.versionOlder version "2.17.0") [ "mircookie" ] 238 ++ lib.optionals (lib.strings.versionAtLeast version "2.17.0") [ 239 "mircommon-internal" 240 "mirserver-internal" 241 ]; 242 }; 243})