From e2627fbe6937c2e9b81a3529e97590150667a339 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Mon, 15 May 2023 22:19:12 +0200 Subject: [PATCH] mir: Modernise derivation - test-related inputs -> checkInputs - use finalAttrs - set meta.changelog - set meta.pkgConfigModules, validate with validatePkgConfig --- pkgs/servers/mir/default.nix | 55 +++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/pkgs/servers/mir/default.nix b/pkgs/servers/mir/default.nix index 45c9efc7b2ca..5f355e868e67 100644 --- a/pkgs/servers/mir/default.nix +++ b/pkgs/servers/mir/default.nix @@ -2,6 +2,7 @@ , lib , fetchFromGitHub , gitUpdater +, testers , cmake , pkg-config , python3 @@ -34,26 +35,17 @@ , gtest , umockdev , wlcs +, validatePkgConfig }: -let - doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; - pythonEnv = python3.withPackages(ps: with ps; [ - pillow - ] ++ lib.optionals doCheck [ - pygobject3 - python-dbusmock - ]); -in - -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "mir"; version = "2.13.0"; src = fetchFromGitHub { owner = "MirServer"; repo = "mir"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-Ip8p4mjcgmZQJTU4MNvWkTTtSJc+cCL3x1mMDFlZrVY="; }; @@ -98,7 +90,13 @@ stdenv.mkDerivation rec { libxslt lttng-ust # lttng-gen-tp pkg-config - pythonEnv + (python3.withPackages (ps: with ps; [ + pillow + ] ++ lib.optionals finalAttrs.doCheck [ + pygobject3 + python-dbusmock + ])) + validatePkgConfig ]; buildInputs = [ @@ -127,21 +125,23 @@ stdenv.mkDerivation rec { xorg.libXcursor xorg.xorgproto xwayland - ] ++ lib.optionals doCheck [ - gtest - umockdev - wlcs ]; nativeCheckInputs = [ dbus ]; + checkInputs = [ + gtest + umockdev + wlcs + ]; + buildFlags = [ "all" "doc" ]; cmakeFlags = [ "-DMIR_PLATFORM='gbm-kms;x11;eglstream-kms;wayland'" - "-DMIR_ENABLE_TESTS=${if doCheck then "ON" else "OFF"}" + "-DMIR_ENABLE_TESTS=${if finalAttrs.doCheck then "ON" else "OFF"}" # BadBufferTest.test_truncated_shm_file *doesn't* throw an error as the test expected, mark as such # https://github.com/MirServer/mir/pull/1947#issuecomment-811810872 "-DMIR_SIGBUS_HANDLER_ENVIRONMENT_BROKEN=ON" @@ -152,7 +152,7 @@ stdenv.mkDerivation rec { "-DMIR_BUILD_PLATFORM_TEST_HARNESS=OFF" ]; - inherit doCheck; + doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; preCheck = '' # Needs to be exactly /tmp so some failing tests don't get run, don't know why they fail yet @@ -163,6 +163,7 @@ stdenv.mkDerivation rec { outputs = [ "out" "dev" "doc" ]; passthru = { + tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; updateScript = gitUpdater { rev-prefix = "v"; }; @@ -179,8 +180,22 @@ stdenv.mkDerivation rec { meta = with lib; { description = "A display server and Wayland compositor developed by Canonical"; homepage = "https://mir-server.io"; + changelog = "https://github.com/MirServer/mir/releases/tag/v${finalAttrs.version}"; license = licenses.gpl2Plus; maintainers = with maintainers; [ onny OPNA2608 ]; platforms = platforms.linux; + pkgConfigModules = [ + "miral" + "mircommon" + "mircookie" + "mircore" + "miroil" + "mirplatform" + "mir-renderer-gl-dev" + "mirrenderer" + "mirserver" + "mirtest" + "mirwayland" + ]; }; -} +})