Merge pull request #272995 from jtojnar/gpaste

gnome.gpaste: Fix typelib path adjustment
This commit is contained in:
Jan Tojnar 2023-12-30 13:18:56 +01:00 committed by GitHub
commit 4da9e47b03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 49 deletions

View File

@ -35,10 +35,6 @@ stdenv.mkDerivation rec {
# TODO: switch to substituteAll with placeholder
# https://github.com/NixOS/nix/issues/1846
postPatch = ''
substituteInPlace src/gnome-shell/extension.js \
--subst-var-by typelibPath "${placeholder "out"}/lib/girepository-1.0"
substituteInPlace src/gnome-shell/prefs.js \
--subst-var-by typelibPath "${placeholder "out"}/lib/girepository-1.0"
substituteInPlace src/libgpaste/gpaste/gpaste-settings.c \
--subst-var-by gschemasCompiled ${glib.makeSchemaPath (placeholder "out") "${pname}-${version}"}
'';
@ -69,6 +65,20 @@ stdenv.mkDerivation rec {
"-Dsystemd-user-unit-dir=${placeholder "out"}/etc/systemd/user"
];
postInstall = ''
# We do not have central location to install typelibs to,
# lets ensure GNOME Shell can still find them.
extensionDir="$out/share/gnome-shell/extensions/GPaste@gnome-shell-extensions.gnome.org"
mv "$extensionDir/"{extension,.extension-wrapped}.js
mv "$extensionDir/"{prefs,.prefs-wrapped}.js
substitute "${./wrapper.js}" "$extensionDir/extension.js" \
--subst-var-by originalName "extension" \
--subst-var-by typelibPath "${placeholder "out"}/lib/girepository-1.0"
substitute "${./wrapper.js}" "$extensionDir/prefs.js" \
--subst-var-by originalName "prefs" \
--subst-var-by typelibPath "${placeholder "out"}/lib/girepository-1.0"
'';
meta = with lib; {
homepage = "https://github.com/Keruspe/GPaste";
description = "Clipboard management system with GNOME 3 integration";

View File

@ -1,48 +1,3 @@
diff --git a/src/gnome-shell/__nix-prepend-search-paths.js b/src/gnome-shell/__nix-prepend-search-paths.js
new file mode 100644
index 00000000..e8e20c67
--- /dev/null
+++ b/src/gnome-shell/__nix-prepend-search-paths.js
@@ -0,0 +1,3 @@
+import GIRepository from 'gi://GIRepository';
+
+GIRepository.Repository.prepend_search_path('@typelibDir@');
diff --git a/src/gnome-shell/extension.js b/src/gnome-shell/extension.js
index cb862a30..980767c9 100644
--- a/src/gnome-shell/extension.js
+++ b/src/gnome-shell/extension.js
@@ -4,6 +4,8 @@
* Copyright (c) 2010-2023, Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
*/
+import './__nix-prepend-search-paths.js';
+
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';
diff --git a/src/gnome-shell/meson.build b/src/gnome-shell/meson.build
index 86cbb0b2..80fc4d67 100644
--- a/src/gnome-shell/meson.build
+++ b/src/gnome-shell/meson.build
@@ -1,4 +1,5 @@
shell_extension_files = [
+ '__nix-prepend-search-paths.js',
'aboutItem.js',
'actionButton.js',
'actionButtonActor.js',
diff --git a/src/gnome-shell/prefs.js b/src/gnome-shell/prefs.js
index 4c0d9bde..58f54f9a 100644
--- a/src/gnome-shell/prefs.js
+++ b/src/gnome-shell/prefs.js
@@ -4,6 +4,8 @@
* Copyright (c) 2010-2023, Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
*/
+import './__nix-prepend-search-paths.js';
+
import { ExtensionPreferences, gettext as _ } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
import GPasteGtk from 'gi://GPasteGtk?version=4';
diff --git a/src/libgpaste/gpaste/gpaste-settings.c b/src/libgpaste/gpaste/gpaste-settings.c
index 830f5e0b..c8df0e11 100644
--- a/src/libgpaste/gpaste/gpaste-settings.c

View File

@ -0,0 +1,5 @@
import GIRepository from 'gi://GIRepository';
GIRepository.Repository.prepend_search_path('@typelibDir@');
export default (await import('./.@originalName@-wrapped.js')).default;