nixpkgs/pkgs/desktops/gnome-3/misc/gpaste/default.nix
Jan Tojnar f63d94eba3
gnome3.gpaste: hard-code paths
GPaste GNOME Shell extension uses GPaste library generated via introspection. Previously, we added the gpaste package to services.xserver.desktopManager.gnome3.sessionPath option, which
added its typelib directory to GI_TYPELIB_PATH environment variable globally, in order for GNOME Shell to be able to find it. This is not very Nix-y, though, so we have decided to patch the code to
append the path to the GI repository search path.

Additionally, the code relies on GPaste’s GSettings schemas, so we had to hard-code the paths to them as well. We ignored the GNOME Shell’s schemas, since they will already be available for the
extension inside GNOME Shell program.
2018-08-01 19:14:30 +02:00

48 lines
1.8 KiB
Nix

{ stdenv, fetchurl, autoreconfHook, pkgconfig, vala, glib, gjs, mutter
, pango, gtk3, gnome3, dbus, clutter, appstream-glib, wrapGAppsHook, systemd, gobjectIntrospection }:
stdenv.mkDerivation rec {
version = "3.28.2";
name = "gpaste-${version}";
src = fetchurl {
url = "https://github.com/Keruspe/GPaste/archive/v${version}.tar.gz";
sha256 = "1zfx73qpw976hyzp5k569lywsq2b6dbnnzf2cvhjvn3mvkw8pin2";
};
patches = [
./fix-paths.patch
];
# TODO: switch to substituteAll with placeholder
# https://github.com/NixOS/nix/issues/1846
# https://github.com/NixOS/nixpkgs/pull/37693
postPatch = ''
substituteInPlace src/gnome-shell/extension.js \
--subst-var-by typelibPath "$out/lib/girepository-1.0"
substituteInPlace src/gnome-shell/prefs.js \
--subst-var-by typelibPath "$out/lib/girepository-1.0"
substituteInPlace src/libgpaste/settings/gpaste-settings.c \
--subst-var-by gschemasCompiled "$out/share/gsettings-schemas/${name}/glib-2.0/schemas"
'';
nativeBuildInputs = [ autoreconfHook pkgconfig vala wrapGAppsHook ];
buildInputs = [ glib gjs mutter gnome3.adwaita-icon-theme
gtk3 gnome3.gnome-control-center dbus
clutter pango appstream-glib systemd gobjectIntrospection ];
configureFlags = [ "--with-controlcenterdir=$(out)/share/gnome-control-center/keybindings"
"--with-dbusservicesdir=$(out)/share/dbus-1/services"
"--with-systemduserunitdir=$(out)/etc/systemd/user" ];
enableParallelBuilding = true;
meta = with stdenv.lib; {
homepage = https://github.com/Keruspe/GPaste;
description = "Clipboard management system with GNOME3 integration";
license = licenses.gpl3;
platforms = platforms.linux;
maintainers = gnome3.maintainers;
};
}