diff --git a/nixos/tests/installed-tests/appstream.nix b/nixos/tests/installed-tests/appstream.nix new file mode 100644 index 000000000000..f71a095d4452 --- /dev/null +++ b/nixos/tests/installed-tests/appstream.nix @@ -0,0 +1,9 @@ +{ pkgs, makeInstalledTest, ... }: + +makeInstalledTest { + tested = pkgs.appstream; + + testConfig = { + appstream.enable = true; + }; +} diff --git a/nixos/tests/installed-tests/default.nix b/nixos/tests/installed-tests/default.nix index 08785e5e6669..e6e1386a3731 100644 --- a/nixos/tests/installed-tests/default.nix +++ b/nixos/tests/installed-tests/default.nix @@ -84,6 +84,7 @@ let in { + appstream = callInstalledTest ./appstream.nix {}; colord = callInstalledTest ./colord.nix {}; flatpak = callInstalledTest ./flatpak.nix {}; flatpak-builder = callInstalledTest ./flatpak-builder.nix {}; diff --git a/pkgs/development/libraries/appstream/default.nix b/pkgs/development/libraries/appstream/default.nix index 767cc447d140..d1d6ddcaf202 100644 --- a/pkgs/development/libraries/appstream/default.nix +++ b/pkgs/development/libraries/appstream/default.nix @@ -22,13 +22,14 @@ , gperf , vala , curl +, nixosTests }: stdenv.mkDerivation rec { pname = "appstream"; version = "0.15.2"; - outputs = [ "out" "dev" ]; + outputs = [ "out" "dev" "installedTests" ]; src = fetchFromGitHub { owner = "ximion"; @@ -43,6 +44,9 @@ stdenv.mkDerivation rec { src = ./fix-paths.patch; libstemmer_includedir = "${lib.getDev libstemmer}/include"; }) + + # Allow installing installed tests to a separate output. + ./installed-tests-path.patch ]; nativeBuildInputs = [ @@ -75,8 +79,15 @@ stdenv.mkDerivation rec { "-Dapidocs=false" "-Ddocs=false" "-Dvapi=true" + "-Dinstalled_test_prefix=${placeholder "installedTests"}" ]; + passthru = { + tests = { + installed-tests = nixosTests.installed-tests.appstream; + }; + }; + meta = with lib; { description = "Software metadata handling library"; homepage = "https://www.freedesktop.org/wiki/Distributions/AppStream/"; diff --git a/pkgs/development/libraries/appstream/installed-tests-path.patch b/pkgs/development/libraries/appstream/installed-tests-path.patch new file mode 100644 index 000000000000..188c1e525890 --- /dev/null +++ b/pkgs/development/libraries/appstream/installed-tests-path.patch @@ -0,0 +1,27 @@ +diff --git a/meson_options.txt b/meson_options.txt +index 8dd8e0c7..e2a30b06 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -44,6 +44,11 @@ option('install-docs', + value : true, + description : 'Install documentation for API and specification' + ) ++option('installed_test_prefix', ++ type : 'string', ++ value : '', ++ description : 'Prefix for installed tests' ++) + + # + # For development +diff --git a/tests/installed-tests/meson.build b/tests/installed-tests/meson.build +index 405820ce..f592a753 100644 +--- a/tests/installed-tests/meson.build ++++ b/tests/installed-tests/meson.build +@@ -10,5 +10,5 @@ configure_file( + output : 'metainfo-validate.test', + configuration : itconf, + install: true, +- install_dir: join_paths('share', 'installed-tests', 'appstream'), ++ install_dir: join_paths(get_option('installed_test_prefix'), 'share', 'installed-tests', 'appstream'), + )