diff options
Diffstat (limited to 'pkgs/desktops/gnome/extensions/gsconnect')
3 files changed, 183 insertions, 0 deletions
diff --git a/pkgs/desktops/gnome/extensions/gsconnect/default.nix b/pkgs/desktops/gnome/extensions/gsconnect/default.nix new file mode 100644 index 0000000000000..c924b4e3eca05 --- /dev/null +++ b/pkgs/desktops/gnome/extensions/gsconnect/default.nix @@ -0,0 +1,116 @@ +{ lib, stdenv +, fetchFromGitHub +, substituteAll +, openssl +, gsound +, meson +, ninja +, pkg-config +, gobject-introspection +, wrapGAppsHook +, glib +, glib-networking +, gtk3 +, openssh +, gnome +, gjs +, nixosTests +}: + +stdenv.mkDerivation rec { + pname = "gnome-shell-gsconnect"; + version = "46"; + + outputs = [ "out" "installedTests" ]; + + src = fetchFromGitHub { + owner = "andyholmes"; + repo = "gnome-shell-extension-gsconnect"; + rev = "v${version}"; + sha256 = "161379kipr6z6gbhchb5b17djrkg5fbvblyyabzkc2gv05r3h6fw"; + }; + + patches = [ + # Make typelibs available in the extension + (substituteAll { + src = ./fix-paths.patch; + gapplication = "${glib.bin}/bin/gapplication"; + }) + + # Allow installing installed tests to a separate output + ./installed-tests-path.patch + ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + gobject-introspection # for locating typelibs + wrapGAppsHook # for wrapping daemons + ]; + + buildInputs = [ + glib # libgobject + glib-networking + gtk3 + gsound + gjs # for running daemon + gnome.evolution-data-server # for libebook-contacts typelib + ]; + + mesonFlags = [ + "-Dgnome_shell_libdir=${gnome.gnome-shell}/lib" + "-Dgsettings_schemadir=${glib.makeSchemaPath (placeholder "out") "${pname}-${version}"}" + "-Dchrome_nmhdir=${placeholder "out"}/etc/opt/chrome/native-messaging-hosts" + "-Dchromium_nmhdir=${placeholder "out"}/etc/chromium/native-messaging-hosts" + "-Dopenssl_path=${openssl}/bin/openssl" + "-Dsshadd_path=${openssh}/bin/ssh-add" + "-Dsshkeygen_path=${openssh}/bin/ssh-keygen" + "-Dsession_bus_services_dir=${placeholder "out"}/share/dbus-1/services" + "-Dpost_install=true" + "-Dinstalled_test_prefix=${placeholder "installedTests"}" + ]; + + postPatch = '' + patchShebangs meson/nmh.sh + patchShebangs meson/post-install.sh + patchShebangs installed-tests/prepare-tests.sh + + # TODO: do not include every typelib everywhere + # for example, we definitely do not need nautilus + for file in src/extension.js src/prefs.js; do + substituteInPlace "$file" \ + --subst-var-by typelibPath "$GI_TYPELIB_PATH" + done + ''; + + postFixup = '' + # Let’s wrap the daemons + for file in $out/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/{daemon,nativeMessagingHost}.js; do + echo "Wrapping program $file" + wrapGApp "$file" + done + + # Wrap jasmine runner for tests + for file in $installedTests/libexec/installed-tests/gsconnect/minijasmine; do + echo "Wrapping program $file" + wrapGApp "$file" + done + ''; + + uuid = "gsconnect@andyholmes.github.io"; + + passthru = { + tests = { + installedTests = nixosTests.installed-tests.gsconnect; + }; + }; + + meta = with lib; { + description = "KDE Connect implementation for Gnome Shell"; + homepage = "https://github.com/andyholmes/gnome-shell-extension-gsconnect/wiki"; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ etu ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/desktops/gnome/extensions/gsconnect/fix-paths.patch b/pkgs/desktops/gnome/extensions/gsconnect/fix-paths.patch new file mode 100644 index 0000000000000..58c02a92eb2ef --- /dev/null +++ b/pkgs/desktops/gnome/extensions/gsconnect/fix-paths.patch @@ -0,0 +1,37 @@ +diff --git i/data/org.gnome.Shell.Extensions.GSConnect.desktop.in w/data/org.gnome.Shell.Extensions.GSConnect.desktop.in +index ffb23342..b405c73b 100644 +--- i/data/org.gnome.Shell.Extensions.GSConnect.desktop.in ++++ w/data/org.gnome.Shell.Extensions.GSConnect.desktop.in +@@ -1,7 +1,7 @@ + [Desktop Entry] + Type=Application + Name=GSConnect +-Exec=gapplication launch org.gnome.Shell.Extensions.GSConnect %U ++Exec=@gapplication@ launch org.gnome.Shell.Extensions.GSConnect %U + Terminal=false + NoDisplay=true + Icon=org.gnome.Shell.Extensions.GSConnect +diff --git i/src/extension.js w/src/extension.js +index 5f32aa68..872c0c61 100644 +--- i/src/extension.js ++++ w/src/extension.js +@@ -1,5 +1,7 @@ + 'use strict'; + ++'@typelibPath@'.split(':').forEach(path => imports.gi.GIRepository.Repository.prepend_search_path(path)); ++ + const Gio = imports.gi.Gio; + const GObject = imports.gi.GObject; + const Gtk = imports.gi.Gtk; +diff --git i/src/prefs.js w/src/prefs.js +index 07e93099..1c166710 100644 +--- i/src/prefs.js ++++ w/src/prefs.js +@@ -1,5 +1,7 @@ + 'use strict'; + ++'@typelibPath@'.split(':').forEach(path => imports.gi.GIRepository.Repository.prepend_search_path(path)); ++ + const Gio = imports.gi.Gio; + const GLib = imports.gi.GLib; + const Gtk = imports.gi.Gtk; diff --git a/pkgs/desktops/gnome/extensions/gsconnect/installed-tests-path.patch b/pkgs/desktops/gnome/extensions/gsconnect/installed-tests-path.patch new file mode 100644 index 0000000000000..78e1ad96d74c3 --- /dev/null +++ b/pkgs/desktops/gnome/extensions/gsconnect/installed-tests-path.patch @@ -0,0 +1,30 @@ +diff --git a/installed-tests/meson.build b/installed-tests/meson.build +index c7eff2fb..ef4f6052 100644 +--- a/installed-tests/meson.build ++++ b/installed-tests/meson.build +@@ -1,5 +1,5 @@ +-installed_tests_execdir = join_paths(libexecdir, 'installed-tests', meson.project_name()) +-installed_tests_metadir = join_paths(datadir, 'installed-tests', meson.project_name()) ++installed_tests_execdir = join_paths(get_option('installed_test_prefix'), 'libexec', 'installed-tests', meson.project_name()) ++installed_tests_metadir = join_paths(get_option('installed_test_prefix'), 'share', 'installed-tests', meson.project_name()) + + installed_tests_srcdir = meson.current_source_dir() + installed_tests_builddir = meson.current_build_dir() +diff --git a/meson_options.txt b/meson_options.txt +index 8912e052..ca6ee5eb 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -116,6 +116,13 @@ option( + description: 'Native Messaging Host directory for Mozilla' + ) + ++option( ++ 'installed_test_prefix', ++ type: 'string', ++ value: '', ++ description: 'Prefix for installed tests' ++) ++ + option( + 'installed_tests', + type: 'boolean', |