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