Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 140 lines 3.5 kB view raw
1{ lib 2, stdenv 3, fetchurl 4, meson 5, ninja 6, pkg-config 7, gobject-introspection 8, vala 9, gi-docgen 10, glib 11, gsettings-desktop-schemas 12, gtk3 13, enableGlade ? false 14, glade 15, xvfb-run 16, gdk-pixbuf 17, librsvg 18, libxml2 19, hicolor-icon-theme 20, at-spi2-atk 21, at-spi2-core 22, gnome 23, libhandy 24, runCommand 25}: 26 27stdenv.mkDerivation rec { 28 pname = "libhandy"; 29 version = "1.8.2"; 30 31 outputs = [ 32 "out" 33 "dev" 34 "devdoc" 35 ] ++ lib.optionals enableGlade [ 36 "glade" 37 ]; 38 outputBin = "dev"; 39 40 src = fetchurl { 41 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; 42 sha256 = "sha256-0RqizT5XCsbQ79ukbRcxR8EfRYJkV+kkwFmQuy4N+a0="; 43 }; 44 45 depsBuildBuild = [ 46 pkg-config 47 ]; 48 49 nativeBuildInputs = [ 50 gobject-introspection 51 gi-docgen 52 meson 53 ninja 54 pkg-config 55 vala 56 ] ++ lib.optionals enableGlade [ 57 libxml2 # for xmllint 58 ]; 59 60 buildInputs = [ 61 gdk-pixbuf 62 gtk3 63 ] ++ lib.optionals enableGlade [ 64 glade 65 ]; 66 67 nativeCheckInputs = [ 68 xvfb-run 69 at-spi2-atk 70 at-spi2-core 71 librsvg 72 hicolor-icon-theme 73 ]; 74 75 mesonFlags = [ 76 "-Dgtk_doc=true" 77 "-Dglade_catalog=${if enableGlade then "enabled" else "disabled"}" 78 ]; 79 80 # Uses define_variable in pkg-config, but we still need it to use the glade output 81 PKG_CONFIG_GLADEUI_2_0_MODULEDIR = "${placeholder "glade"}/lib/glade/modules"; 82 PKG_CONFIG_GLADEUI_2_0_CATALOGDIR = "${placeholder "glade"}/share/glade/catalogs"; 83 84 doCheck = !stdenv.isDarwin; 85 86 checkPhase = '' 87 runHook preCheck 88 89 testEnvironment=( 90 # Disable portal since we cannot run it in tests. 91 HDY_DISABLE_PORTAL=1 92 93 "XDG_DATA_DIRS=${lib.concatStringsSep ":" [ 94 # HdySettings needs to be initialized from “org.gnome.desktop.interface” GSettings schema when portal is not used for color scheme. 95 # It will not actually be used since the “color-scheme” key will only have been introduced in GNOME 42, falling back to detecting theme name. 96 # See hdy_settings_constructed function in https://gitlab.gnome.org/GNOME/libhandy/-/commit/bb68249b005c445947bfb2bee66c91d0fe9c41a4 97 (glib.getSchemaDataDirPath gsettings-desktop-schemas) 98 99 # Some tests require icons 100 "${hicolor-icon-theme}/share" 101 ]}" 102 ) 103 env "''${testEnvironment[@]}" xvfb-run \ 104 meson test --print-errorlogs 105 106 runHook postCheck 107 ''; 108 109 postFixup = '' 110 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back. 111 moveToOutput "share/doc" "$devdoc" 112 ''; 113 114 passthru = { 115 updateScript = gnome.updateScript { 116 packageName = pname; 117 versionPolicy = "odd-unstable"; 118 }; 119 } // lib.optionalAttrs (!enableGlade) { 120 glade = 121 let 122 libhandyWithGlade = libhandy.override { 123 enableGlade = true; 124 }; 125 in runCommand "${libhandy.name}-glade" {} '' 126 cp -r "${libhandyWithGlade.glade}" "$out" 127 chmod -R +w "$out" 128 sed -e "s#${libhandyWithGlade.out}#${libhandy.out}#g" -e "s#${libhandyWithGlade.glade}#$out#g" -i $(find "$out" -type f) 129 ''; 130 }; 131 132 meta = with lib; { 133 changelog = "https://gitlab.gnome.org/GNOME/libhandy/-/tags/${version}"; 134 description = "Building blocks for modern adaptive GNOME apps"; 135 homepage = "https://gitlab.gnome.org/GNOME/libhandy"; 136 license = licenses.lgpl21Plus; 137 maintainers = teams.gnome.members; 138 platforms = platforms.unix; 139 }; 140}