Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 buildPackages, 5 replaceVars, 6 fetchFromGitHub, 7 fetchpatch, 8 meson, 9 mesonEmulatorHook, 10 appstream, 11 ninja, 12 pkg-config, 13 cmake, 14 gettext, 15 xmlto, 16 docbook-xsl-nons, 17 docbook_xml_dtd_45, 18 libxslt, 19 libstemmer, 20 glib, 21 xapian, 22 libxml2, 23 libxmlb, 24 libyaml, 25 gobject-introspection, 26 itstool, 27 gperf, 28 vala, 29 curl, 30 cairo, 31 gdk-pixbuf, 32 pango, 33 librsvg, 34 systemd, 35 nixosTests, 36 testers, 37 withIntrospection ? 38 lib.meta.availableOn stdenv.hostPlatform gobject-introspection 39 && stdenv.hostPlatform.emulatorAvailable buildPackages, 40 withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, 41}: 42 43stdenv.mkDerivation (finalAttrs: { 44 pname = "appstream"; 45 version = "1.0.4"; 46 47 outputs = [ 48 "out" 49 "dev" 50 "installedTests" 51 ]; 52 53 src = fetchFromGitHub { 54 owner = "ximion"; 55 repo = "appstream"; 56 rev = "v${finalAttrs.version}"; 57 sha256 = "sha256-UnSJcXH0yWK/dPKgbOx9x3iJjKcKNYFkD2Qs5c3FtM8="; 58 }; 59 60 patches = [ 61 # Fix hardcoded paths 62 (replaceVars ./fix-paths.patch { 63 libstemmer_includedir = "${lib.getDev libstemmer}/include"; 64 }) 65 66 # Allow installing installed tests to a separate output. 67 ./installed-tests-path.patch 68 69 (fetchpatch { 70 name = "static.patch"; 71 url = "https://github.com/ximion/appstream/commit/90675d8853188f65897d2453346cb0acd531b58f.patch"; 72 hash = "sha256-d3h5h7B/MP3Sun5YwYCqMHcw4PMMwg1YS/S9vsMzkQ4="; 73 }) 74 ]; 75 76 strictDeps = true; 77 78 depsBuildBuild = [ 79 pkg-config 80 ]; 81 82 nativeBuildInputs = [ 83 meson 84 ninja 85 pkg-config 86 cmake 87 gettext 88 libxslt 89 xmlto 90 docbook-xsl-nons 91 docbook_xml_dtd_45 92 glib 93 itstool 94 gperf 95 ] 96 ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ 97 mesonEmulatorHook 98 ] 99 ++ lib.optionals (!lib.systems.equals stdenv.buildPlatform stdenv.hostPlatform) [ 100 appstream 101 ] 102 ++ lib.optionals withIntrospection [ 103 gobject-introspection 104 vala 105 ]; 106 107 buildInputs = [ 108 libstemmer 109 glib 110 xapian 111 libxml2 112 libxmlb 113 libyaml 114 curl 115 cairo 116 gdk-pixbuf 117 pango 118 librsvg 119 ] 120 ++ lib.optionals withSystemd [ 121 systemd 122 ]; 123 124 mesonFlags = [ 125 "-Dapidocs=false" 126 "-Dc_args=-Wno-error=missing-include-dirs" 127 "-Ddocs=false" 128 "-Dvapi=true" 129 "-Dinstalled_test_prefix=${placeholder "installedTests"}" 130 "-Dcompose=true" 131 (lib.mesonBool "gir" withIntrospection) 132 ] 133 ++ lib.optionals (!withSystemd) [ 134 "-Dsystemd=false" 135 ]; 136 137 passthru.tests = { 138 installed-tests = nixosTests.installed-tests.appstream; 139 pkg-config = testers.hasPkgConfigModules { 140 package = finalAttrs.finalPackage; 141 }; 142 }; 143 144 meta = with lib; { 145 description = "Software metadata handling library"; 146 longDescription = '' 147 AppStream is a cross-distro effort for building Software-Center applications 148 and enhancing metadata provided by software components. It provides 149 specifications for meta-information which is shipped by upstream projects and 150 can be consumed by other software. 151 ''; 152 homepage = "https://www.freedesktop.org/wiki/Distributions/AppStream/"; 153 license = licenses.lgpl21Plus; 154 mainProgram = "appstreamcli"; 155 platforms = platforms.unix; 156 pkgConfigModules = [ "appstream" ]; 157 }; 158})