nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 appstream,
5 qtbase,
6 qttools,
7 nixosTests,
8}:
9
10# TODO: look into using the libraries from the regular appstream derivation as we keep duplicates here
11
12let
13 qtSuffix = lib.optionalString (lib.versions.major qtbase.version == "5") "5";
14in
15stdenv.mkDerivation {
16 pname = "appstream-qt";
17 inherit (appstream) version src;
18
19 outputs = [
20 "out"
21 "dev"
22 "installedTests"
23 ];
24
25 buildInputs = appstream.buildInputs ++ [
26 appstream
27 qtbase
28 ];
29
30 nativeBuildInputs = appstream.nativeBuildInputs ++ [ qttools ];
31
32 mesonFlags = appstream.mesonFlags ++ [
33 (lib.mesonBool "qt" true)
34 (lib.mesonOption "qt-versions" (lib.versions.major qtbase.version))
35 ];
36
37 patches = appstream.patches;
38
39 dontWrapQtApps = true;
40
41 # AppStreamQt tries to be relocatable, in hacky cmake ways that generally fail
42 # horribly on NixOS. Just hardcode the paths.
43 postFixup = ''
44 sed -i "$dev/lib/cmake/AppStreamQt${qtSuffix}/AppStreamQt${qtSuffix}Config.cmake" \
45 -e "/INTERFACE_INCLUDE_DIRECTORIES/ s@\''${PACKAGE_PREFIX_DIR}@$dev@"
46 sed -i "$dev/lib/cmake/AppStreamQt${qtSuffix}/AppStreamQt${qtSuffix}Config.cmake" \
47 -e "/IMPORTED_LOCATION/ s@\''${PACKAGE_PREFIX_DIR}@$out@"
48 '';
49
50 passthru = appstream.passthru // {
51 tests = {
52 installed-tests = nixosTests.installed-tests.appstream-qt;
53 };
54 };
55
56 meta = appstream.meta // {
57 description = "Software metadata handling library - Qt";
58 };
59}