about summary refs log tree commit diff
path: root/pkgs/desktops/gnome/misc/gpaste/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/desktops/gnome/misc/gpaste/default.nix')
-rw-r--r--pkgs/desktops/gnome/misc/gpaste/default.nix18
1 files changed, 14 insertions, 4 deletions
diff --git a/pkgs/desktops/gnome/misc/gpaste/default.nix b/pkgs/desktops/gnome/misc/gpaste/default.nix
index 2051f19a37be0..2f66d742f969c 100644
--- a/pkgs/desktops/gnome/misc/gpaste/default.nix
+++ b/pkgs/desktops/gnome/misc/gpaste/default.nix
@@ -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,
+    # let’s 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";