From 2cbe3a443fd7d113ab1972fc4a821b4ecb523a1d Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sun, 14 Dec 2025 22:04:22 +0100 Subject: [PATCH] mir: 2.23.0 -> 2.25.1 --- pkgs/servers/mir/common.nix | 426 +++++++++++++++++++---------------- pkgs/servers/mir/default.nix | 5 +- 2 files changed, 230 insertions(+), 201 deletions(-) diff --git a/pkgs/servers/mir/common.nix b/pkgs/servers/mir/common.nix index dc4111c165e7..0f0ec736f8fe 100644 --- a/pkgs/servers/mir/common.nix +++ b/pkgs/servers/mir/common.nix @@ -1,10 +1,13 @@ { stdenv, + rustPlatform, lib, fetchFromGitHub, nixosTests, testers, + cargo, cmake, + ctestCheckHook, pkg-config, python3, boost, @@ -46,216 +49,241 @@ version, pinned ? false, hash, + cargoHash ? null, patches ? [ ], }: -stdenv.mkDerivation (finalAttrs: { - pname = "mir"; - inherit version; +stdenv.mkDerivation ( + finalAttrs: + { + pname = "mir"; + inherit version; - src = fetchFromGitHub { - owner = "canonical"; - repo = "mir"; - rev = "v${finalAttrs.version}"; - inherit hash; - }; + src = fetchFromGitHub { + owner = "canonical"; + repo = "mir"; + rev = "v${finalAttrs.version}"; + inherit hash; + }; - inherit patches; + inherit patches; - postPatch = '' - # Fix scripts that get run in tests - patchShebangs tools/detect_fd_leaks.bash tests/acceptance-tests/wayland-generator/test_wayland_generator.sh.in + postPatch = '' + # Fix scripts that get run in tests + patchShebangs tools/detect_fd_leaks.bash tests/acceptance-tests/wayland-generator/test_wayland_generator.sh.in - # Fix LD_PRELOADing in tests - substituteInPlace \ - cmake/MirCommon.cmake \ - tests/umock-acceptance-tests/CMakeLists.txt \ - tests/unit-tests/platforms/gbm-kms/kms/CMakeLists.txt \ - tests/unit-tests/CMakeLists.txt \ - --replace-warn 'LD_PRELOAD=liblttng-ust-fork.so' 'LD_PRELOAD=${lib.getLib lttng-ust}/lib/liblttng-ust-fork.so' \ - --replace-warn 'LD_PRELOAD=libumockdev-preload.so.0' 'LD_PRELOAD=${lib.getLib umockdev}/lib/libumockdev-preload.so.0' + # Fix LD_PRELOADing in tests + substituteInPlace \ + cmake/MirCommon.cmake \ + tests/umock-acceptance-tests/CMakeLists.txt \ + tests/unit-tests/platforms/gbm-kms/kms/CMakeLists.txt \ + tests/unit-tests/CMakeLists.txt \ + --replace-warn 'LD_PRELOAD=liblttng-ust-fork.so' 'LD_PRELOAD=${lib.getLib lttng-ust}/lib/liblttng-ust-fork.so' \ + --replace-warn 'LD_PRELOAD=libumockdev-preload.so.0' 'LD_PRELOAD=${lib.getLib umockdev}/lib/libumockdev-preload.so.0' - # Fix Xwayland default - substituteInPlace src/miral/x11_support.cpp \ - --replace-fail '/usr/bin/Xwayland' '${lib.getExe xwayland}' - '' - + lib.optionalString (lib.strings.versionOlder version "2.18.0") '' + # Fix Xwayland default + substituteInPlace src/miral/x11_support.cpp \ + --replace-fail '/usr/bin/Xwayland' '${lib.getExe xwayland}' + '' + + lib.optionalString (lib.strings.versionOlder version "2.18.0") '' - # Fix paths for generating drm-formats - substituteInPlace src/platform/graphics/CMakeLists.txt \ - --replace-fail "/usr/include/drm/drm_fourcc.h" "${lib.getDev libdrm}/include/libdrm/drm_fourcc.h" \ - --replace-fail "/usr/include/libdrm/drm_fourcc.h" "${lib.getDev libdrm}/include/libdrm/drm_fourcc.h" - ''; + # Fix paths for generating drm-formats + substituteInPlace src/platform/graphics/CMakeLists.txt \ + --replace-fail "/usr/include/drm/drm_fourcc.h" "${lib.getDev libdrm}/include/libdrm/drm_fourcc.h" \ + --replace-fail "/usr/include/libdrm/drm_fourcc.h" "${lib.getDev libdrm}/include/libdrm/drm_fourcc.h" + ''; - strictDeps = true; + strictDeps = true; - nativeBuildInputs = [ - cmake - glib # gdbus-codegen - lttng-ust # lttng-gen-tp - pkg-config - (python3.withPackages ( - ps: - with ps; - [ pillow ] - ++ lib.optionals finalAttrs.finalPackage.doCheck [ - pygobject3 - python-dbusmock - ] - )) - validatePkgConfig - wayland-scanner - ]; - - buildInputs = [ - boost - egl-wayland - freetype - glib - glm - libdrm - libepoxy - libevdev - libglvnd - libinput - libuuid - libxcb - libxkbcommon - libxmlxx - yaml-cpp - lttng-ust - libgbm - nettle - udev - wayland - xorg.libX11 - xorg.libXcursor - xorg.xorgproto - xwayland - ] - ++ lib.optionals (lib.strings.versionAtLeast version "2.18.0") [ - libapparmor - ] - ++ lib.optionals (lib.strings.versionAtLeast version "2.21.0") [ - pixman - ] - ++ lib.optionals (lib.strings.versionAtLeast version "2.22.0") [ - libdisplay-info - ]; - - nativeCheckInputs = [ - dbus - gobject-introspection - ] - ++ lib.optionals (lib.strings.versionAtLeast version "2.22.0") [ - mesa.llvmpipeHook - ] - ++ lib.optionals (lib.strings.versionAtLeast version "2.23.0") [ - xwayland - ]; - - checkInputs = [ - gtest - umockdev - wlcs - ]; - - cmakeFlags = [ - (lib.cmakeBool "BUILD_DOXYGEN" false) - (lib.cmakeFeature "MIR_PLATFORM" ( - lib.strings.concatStringsSep ";" [ - "atomic-kms" - "gbm-kms" - "eglstream-kms" - "x11" - "wayland" - ] - )) - (lib.cmakeBool "MIR_ENABLE_TESTS" finalAttrs.finalPackage.doCheck) - # BadBufferTest.test_truncated_shm_file *doesn't* throw an error as the test expected, mark as such - # https://github.com/canonical/mir/pull/1947#issuecomment-811810872 - (lib.cmakeBool "MIR_SIGBUS_HANDLER_ENVIRONMENT_BROKEN" true) - (lib.cmakeFeature "MIR_EXCLUDE_TESTS" ( - lib.strings.concatStringsSep ";" ( - lib.optionals (lib.strings.versionOlder version "2.22.0") [ - # https://github.com/canonical/mir/issues/3716#issuecomment-2580698552 - "UdevWrapperTest.UdevMonitorDoesNotTriggerBeforeEnabling" + nativeBuildInputs = [ + cmake + glib # gdbus-codegen + lttng-ust # lttng-gen-tp + pkg-config + (python3.withPackages ( + ps: + with ps; + [ pillow ] + ++ lib.optionals finalAttrs.finalPackage.doCheck [ + pygobject3 + python-dbusmock ] - ) - )) - # These get built but don't get executed by default, yet they get installed when tests are enabled - (lib.cmakeBool "MIR_BUILD_PERFORMANCE_TESTS" false) - (lib.cmakeBool "MIR_BUILD_PLATFORM_TEST_HARNESS" false) - # https://github.com/canonical/mir/issues/2987 - # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106799 - (lib.cmakeBool "MIR_USE_PRECOMPILED_HEADERS" false) - (lib.cmakeFeature "MIR_COMPILER_QUIRKS" ( - lib.strings.concatStringsSep ";" ( - lib.optionals (lib.strings.versionOlder version "2.22.0") [ - # https://github.com/canonical/mir/issues/3017 actually affects x86_64 as well - "test_touchspot_controller.cpp:array-bounds" - ] - ) - )) - ]; - - doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; - - preCheck = '' - export HOME=$TMP # shader cache - export XDG_RUNTIME_DIR=$TMP - ''; - - outputs = [ - "out" - "dev" - ]; - - passthru = { - tests = { - pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; - } - // lib.optionalAttrs (!pinned) { inherit (nixosTests) miriway miracle-wm; }; - providedSessions = lib.optionals (lib.strings.versionOlder version "2.16.0") [ - # More of an example than a fully functioning shell, some notes for the adventurous: - # - ~/.config/miral-shell.config is one possible user config location, - # accepted options=value are according to `mir-shell --help` - # - default icon theme setting is DMZ-White, needs vanilla-dmz installed & on XCURSOR_PATH - # or setting to be changed to an available theme - # - terminal emulator setting may need to be changed if miral-terminal script - # does not know about preferred terminal - "mir-shell" - ]; - } - // lib.optionalAttrs (!pinned) { updateScript = ./update.sh; }; - - meta = { - description = "Display server and Wayland compositor developed by Canonical"; - homepage = "https://mir-server.io"; - changelog = "https://github.com/canonical/mir/releases/tag/v${finalAttrs.version}"; - license = lib.licenses.gpl2Plus; - maintainers = with lib.maintainers; [ - OPNA2608 - ]; - # Onle LE has valid graphics buffer formats - # https://github.com/canonical/mir/blob/ba8e83f75084379dec8e23131fdf04fa4a4567ac/src/platforms/common/server/shm_buffer.cpp#L61-L65 - platforms = lib.lists.intersectLists lib.platforms.linux lib.platforms.littleEndian; - pkgConfigModules = [ - "miral" - "mircommon" - "mircore" - "miroil" - "mirplatform" - "mir-renderer-gl-dev" - "mirrenderer" - "mirserver" - "mirtest" - "mirwayland" + )) + validatePkgConfig + wayland-scanner ] - ++ lib.optionals (lib.strings.versionOlder version "2.17.0") [ "mircookie" ] - ++ lib.optionals (lib.strings.versionAtLeast version "2.17.0") [ - "mircommon-internal" - "mirserver-internal" + ++ lib.optionals (lib.strings.versionAtLeast version "2.22.0") [ + rustPlatform.cargoSetupHook + cargo ]; - }; -}) + + buildInputs = [ + boost + egl-wayland + freetype + glib + glm + libdrm + libepoxy + libevdev + libglvnd + libinput + libuuid + libxcb + libxkbcommon + libxmlxx + yaml-cpp + lttng-ust + libgbm + nettle + udev + wayland + xorg.libX11 + xorg.libXcursor + xorg.xorgproto + xwayland + ] + ++ lib.optionals (lib.strings.versionAtLeast version "2.18.0") [ + libapparmor + ] + ++ lib.optionals (lib.strings.versionAtLeast version "2.21.0") [ + pixman + ] + ++ lib.optionals (lib.strings.versionAtLeast version "2.22.0") [ + libdisplay-info + ]; + + nativeCheckInputs = [ + ctestCheckHook + dbus + gobject-introspection + ] + ++ lib.optionals (lib.strings.versionAtLeast version "2.22.0") [ + mesa.llvmpipeHook + ] + ++ lib.optionals (lib.strings.versionAtLeast version "2.23.0") [ + xwayland + ]; + + checkInputs = [ + gtest + umockdev + wlcs + ]; + + cmakeFlags = [ + (lib.cmakeBool "BUILD_DOXYGEN" false) + (lib.cmakeFeature "MIR_PLATFORM" ( + lib.strings.concatStringsSep ";" [ + "atomic-kms" + "gbm-kms" + "eglstream-kms" + "x11" + "wayland" + ] + )) + (lib.cmakeBool "MIR_ENABLE_TESTS" finalAttrs.finalPackage.doCheck) + # BadBufferTest.test_truncated_shm_file *doesn't* throw an error as the test expected, mark as such + # https://github.com/canonical/mir/pull/1947#issuecomment-811810872 + (lib.cmakeBool "MIR_SIGBUS_HANDLER_ENVIRONMENT_BROKEN" true) + (lib.cmakeFeature "MIR_EXCLUDE_TESTS" ( + lib.strings.concatStringsSep ";" ( + lib.optionals (lib.strings.versionOlder version "2.22.0") [ + # https://github.com/canonical/mir/issues/3716#issuecomment-2580698552 + "UdevWrapperTest.UdevMonitorDoesNotTriggerBeforeEnabling" + ] + ) + )) + # These get built but don't get executed by default, yet they get installed when tests are enabled + (lib.cmakeBool "MIR_BUILD_PERFORMANCE_TESTS" false) + (lib.cmakeBool "MIR_BUILD_PLATFORM_TEST_HARNESS" false) + (lib.cmakeBool "MIR_USE_APPARMOR" true) + (lib.cmakeBool "MIR_ENABLE_RUST" true) + # https://github.com/canonical/mir/issues/2987 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106799 + (lib.cmakeBool "MIR_USE_PRECOMPILED_HEADERS" false) + (lib.cmakeFeature "MIR_COMPILER_QUIRKS" ( + lib.strings.concatStringsSep ";" ( + lib.optionals (lib.strings.versionOlder version "2.22.0") [ + # https://github.com/canonical/mir/issues/3017 actually affects x86_64 as well + "test_touchspot_controller.cpp:array-bounds" + ] + ) + )) + ]; + + doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + + disabledTests = lib.optionals (lib.strings.versionAtLeast version "2.25.0") [ + # We don't care about the documentation, so we also don't care if there are any changes in it + "verify-options-reference-unchanged" + ]; + + preCheck = '' + export HOME=$TMP # shader cache + export XDG_RUNTIME_DIR=$TMP + ''; + + outputs = [ + "out" + "dev" + ]; + + passthru = { + tests = { + pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; + } + // lib.optionalAttrs (!pinned) { inherit (nixosTests) miriway miracle-wm; }; + providedSessions = lib.optionals (lib.strings.versionOlder version "2.16.0") [ + # More of an example than a fully functioning shell, some notes for the adventurous: + # - ~/.config/miral-shell.config is one possible user config location, + # accepted options=value are according to `mir-shell --help` + # - default icon theme setting is DMZ-White, needs vanilla-dmz installed & on XCURSOR_PATH + # or setting to be changed to an available theme + # - terminal emulator setting may need to be changed if miral-terminal script + # does not know about preferred terminal + "mir-shell" + ]; + } + // lib.optionalAttrs (!pinned) { updateScript = ./update.sh; }; + + meta = { + description = "Display server and Wayland compositor developed by Canonical"; + homepage = "https://mir-server.io"; + changelog = "https://github.com/canonical/mir/releases/tag/v${finalAttrs.version}"; + license = lib.licenses.gpl2Plus; + maintainers = with lib.maintainers; [ + OPNA2608 + ]; + # Onle LE has valid graphics buffer formats + # https://github.com/canonical/mir/blob/ba8e83f75084379dec8e23131fdf04fa4a4567ac/src/platforms/common/server/shm_buffer.cpp#L61-L65 + platforms = lib.lists.intersectLists lib.platforms.linux lib.platforms.littleEndian; + pkgConfigModules = [ + "miral" + "mircommon" + "mircore" + "miroil" + "mirplatform" + "mirserver" + "mirtest" + "mirwayland" + ] + ++ lib.optionals (lib.strings.versionOlder version "2.17.0") [ "mircookie" ] + ++ lib.optionals (lib.strings.versionAtLeast version "2.17.0") [ + "mircommon-internal" + "mirserver-internal" + ] + ++ lib.optionals (lib.strings.versionOlder version "2.25.0") [ + "mir-renderer-gl-dev" + "mirrenderer" + ]; + }; + } + // lib.optionalAttrs (lib.strings.versionAtLeast version "2.22.0") { + cargoDeps = rustPlatform.fetchCargoVendor { + src = finalAttrs.src; + sourceRoot = finalAttrs.src.name; + hash = cargoHash; + }; + } +) diff --git a/pkgs/servers/mir/default.nix b/pkgs/servers/mir/default.nix index bf354a75dd68..3444daf5e962 100644 --- a/pkgs/servers/mir/default.nix +++ b/pkgs/servers/mir/default.nix @@ -5,8 +5,9 @@ let in { mir = common { - version = "2.23.0"; - hash = "sha256-Sib2dxNDxyJCJwxuP8TVphdZvnkrn+8/t7cnEjfXIsw="; + version = "2.25.1"; + hash = "sha256-i2kvOCP6uomRmg0GlGk2AJCTehW+uN91zZ3NQh1A/rw="; + cargoHash = "sha256-fVD+RGU/2UGVihIktKg2+eDWmlWomDOAcrY6k2XwF1c="; }; mir_2_15 = common {