nixpkgs/pkgs/development/libraries/libshumate/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

102 lines
1.8 KiB
Nix

{ lib
, stdenv
, fetchurl
, gi-docgen
, meson
, ninja
, pkg-config
, vala
, gobject-introspection
, gperf
, glib
, cairo
, sqlite
, libsoup_3
, gtk4
, libsysprof-capture
, json-glib
, protobufc
, xvfb-run
, gnome
}:
stdenv.mkDerivation (finalAttrs: {
pname = "libshumate";
version = "1.2.3";
outputs = [ "out" "dev" "devdoc" ];
outputBin = "devdoc"; # demo app
src = fetchurl {
url = "mirror://gnome/sources/libshumate/${lib.versions.majorMinor finalAttrs.version}/libshumate-${finalAttrs.version}.tar.xz";
hash = "sha256-TMbNc/bYcVX2J2arY+WqzEc72aDONZBpMqz8g56WTAw=";
};
depsBuildBuild = [
# required to find native gi-docgen when cross compiling
pkg-config
];
nativeBuildInputs = [
gi-docgen
meson
ninja
pkg-config
vala
gobject-introspection
gperf
];
buildInputs = [
glib
cairo
sqlite
libsoup_3
gtk4
libsysprof-capture
json-glib
protobufc
];
nativeCheckInputs = [
xvfb-run
];
mesonFlags = [
"-Ddemos=true"
];
doCheck = !stdenv.hostPlatform.isDarwin;
checkPhase = ''
runHook preCheck
env \
HOME="$TMPDIR" \
GTK_A11Y=none \
xvfb-run meson test --print-errorlogs
runHook postCheck
'';
postFixup = ''
# Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
moveToOutput share/doc/libshumate-1.0 "$devdoc"
'';
passthru = {
updateScript = gnome.updateScript {
packageName = "libshumate";
};
};
meta = with lib; {
description = "GTK toolkit providing widgets for embedded maps";
mainProgram = "shumate-demo";
homepage = "https://gitlab.gnome.org/GNOME/libshumate";
license = licenses.lgpl21Plus;
maintainers = teams.gnome.members;
platforms = platforms.unix;
};
})