nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchurl,
5 meson,
6 ninja,
7 gettext,
8 pkg-config,
9 gnome,
10 glib,
11 gtk4,
12 gobject-introspection,
13 gdk-pixbuf,
14 librest_1_0,
15 libgweather,
16 geoclue2,
17 wrapGAppsHook4,
18 desktop-file-utils,
19 libportal,
20 libshumate,
21 libsecret,
22 libsoup_3,
23 gsettings-desktop-schemas,
24 gjs,
25 libadwaita,
26 geocode-glib_2,
27 tzdata,
28 writeText,
29}:
30
31stdenv.mkDerivation (finalAttrs: {
32 pname = "gnome-maps";
33 version = "48.4";
34
35 src = fetchurl {
36 url = "mirror://gnome/sources/gnome-maps/${lib.versions.major finalAttrs.version}/gnome-maps-${finalAttrs.version}.tar.xz";
37 hash = "sha256-rocWuLCz/r0+0iwX6QYuuA9tbSXFBQHATUIwuXzuRco=";
38 };
39
40 doCheck = !stdenv.hostPlatform.isDarwin;
41
42 nativeBuildInputs = [
43 gettext
44 meson
45 ninja
46 pkg-config
47 wrapGAppsHook4
48 gobject-introspection
49 # For post install script
50 desktop-file-utils
51 glib
52 gtk4
53 ];
54
55 buildInputs = [
56 gdk-pixbuf
57 glib
58 geoclue2
59 geocode-glib_2
60 gjs
61 gsettings-desktop-schemas
62 gtk4
63 libportal
64 libshumate
65 libgweather
66 libadwaita
67 librest_1_0
68 libsecret
69 libsoup_3
70 ];
71
72 mesonFlags = [
73 "--cross-file=${writeText "crossfile.ini" ''
74 [binaries]
75 gjs = '${lib.getExe gjs}'
76 ''}"
77 ];
78
79 postPatch = ''
80 # The .service file isn't wrapped with the correct environment
81 # so misses GIR files when started. By re-pointing from the gjs
82 # entry point to the wrapped binary we get back to a wrapped
83 # binary.
84 substituteInPlace "data/org.gnome.Maps.service.in" \
85 --replace-fail "Exec=@pkgdatadir@/@app-id@" \
86 "Exec=$out/bin/gnome-maps"
87 '';
88
89 preCheck = ''
90 # “time.js” included by “timeTest” and “translationsTest” depends on “org.gnome.desktop.interface” schema.
91 export XDG_DATA_DIRS="${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:$XDG_DATA_DIRS"
92 export HOME=$(mktemp -d)
93 export TZDIR=${tzdata}/share/zoneinfo
94
95 # Our gobject-introspection patches make the shared library paths absolute
96 # in the GIR files. When running tests, the library is not yet installed,
97 # though, so we need to replace the absolute path with a local one during build.
98 # We are using a symlink that we will delete before installation.
99 mkdir -p $out/lib/gnome-maps
100 ln -s $PWD/lib/libgnome-maps.so.0 $out/lib/gnome-maps/libgnome-maps.so.0
101 '';
102
103 postCheck = ''
104 rm $out/lib/gnome-maps/libgnome-maps.so.0
105 '';
106
107 preFixup = ''
108 substituteInPlace "$out/share/applications/org.gnome.Maps.desktop" \
109 --replace-fail "Exec=gapplication launch org.gnome.Maps" \
110 "Exec=gnome-maps"
111 '';
112
113 passthru = {
114 updateScript = gnome.updateScript { packageName = "gnome-maps"; };
115 };
116
117 meta = with lib; {
118 homepage = "https://apps.gnome.org/Maps/";
119 description = "Map application for GNOME 3";
120 mainProgram = "gnome-maps";
121 teams = [ teams.gnome ];
122 license = licenses.gpl2Plus;
123 platforms = platforms.unix;
124 };
125})