diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index a8718bd7787..bb3abc256fc 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -200,6 +200,7 @@ ./services/desktops/dleyna-server.nix ./services/desktops/geoclue2.nix ./services/desktops/gnome3/at-spi2-core.nix + ./services/desktops/gnome3/chrome-gnome-shell.nix ./services/desktops/gnome3/evolution-data-server.nix ./services/desktops/gnome3/gnome-disks.nix ./services/desktops/gnome3/gnome-documents.nix diff --git a/nixos/modules/services/desktops/gnome3/chrome-gnome-shell.nix b/nixos/modules/services/desktops/gnome3/chrome-gnome-shell.nix new file mode 100644 index 00000000000..2740a22c7ca --- /dev/null +++ b/nixos/modules/services/desktops/gnome3/chrome-gnome-shell.nix @@ -0,0 +1,27 @@ +# Chrome GNOME Shell native host connector. +{ config, lib, pkgs, ... }: + +with lib; + +{ + ###### interface + options = { + services.gnome3.chrome-gnome-shell.enable = mkEnableOption '' + Chrome GNOME Shell native host connector, a DBus service + allowing to install GNOME Shell extensions from a web browser. + ''; + }; + + + ###### implementation + config = mkIf config.services.gnome3.chrome-gnome-shell.enable { + environment.etc = { + "chromium/native-messaging-hosts/org.gnome.chrome_gnome_shell.json".source = "${pkgs.chrome-gnome-shell}/etc/chromium/native-messaging-hosts/org.gnome.chrome_gnome_shell.json"; + "opt/chrome/native-messaging-hosts/org.gnome.chrome_gnome_shell.json".source = "${pkgs.chrome-gnome-shell}/etc/opt/chrome/native-messaging-hosts/org.gnome.chrome_gnome_shell.json"; + }; + + environment.systemPackages = [ pkgs.chrome-gnome-shell ]; + + services.dbus.packages = [ pkgs.chrome-gnome-shell ]; + }; +} diff --git a/pkgs/applications/networking/browsers/firefox/wrapper.nix b/pkgs/applications/networking/browsers/firefox/wrapper.nix index dd4cb439c1f..010f60881b5 100644 --- a/pkgs/applications/networking/browsers/firefox/wrapper.nix +++ b/pkgs/applications/networking/browsers/firefox/wrapper.nix @@ -8,7 +8,7 @@ , google_talk_plugin, fribid, gnome3/*.gnome_shell*/ , esteidfirefoxplugin , vlc_npapi -, browserpass +, browserpass, chrome-gnome-shell , libudev , kerberos }: @@ -63,6 +63,7 @@ let nativeMessagingHosts = ([ ] ++ lib.optional (cfg.enableBrowserpass or false) browserpass + ++ lib.optional (cfg.enableGnomeExtensions or false) chrome-gnome-shell ++ extraNativeMessagingHosts ); libs = (if ffmpegSupport then [ ffmpeg ] else with gst_all; [ gstreamer gst-plugins-base ]) diff --git a/pkgs/desktops/gnome-3/extensions/chrome-gnome-shell/default.nix b/pkgs/desktops/gnome-3/extensions/chrome-gnome-shell/default.nix index bda356cf4c3..11d891b6743 100644 --- a/pkgs/desktops/gnome-3/extensions/chrome-gnome-shell/default.nix +++ b/pkgs/desktops/gnome-3/extensions/chrome-gnome-shell/default.nix @@ -1,31 +1,36 @@ -{stdenv, lib, python, dbus, fetchgit, cmake, coreutils, jq, gobjectIntrospection, python27Packages, makeWrapper, gnome3, wrapGAppsHook}: +{stdenv, fetchurl, cmake, ninja, jq, python3, gnome3, wrapGAppsHook}: -stdenv.mkDerivation rec { -name="chrome-gnome-shell"; - src = fetchgit { - url = "git://git.gnome.org/chrome-gnome-shell"; - rev = "7d99523e90805cb65027cc2f5f1191a957dcf276"; - sha256 = "0qc34dbhsz5yf4z5bx6py08h561rcxw9928drgk9256g3vnygnbc"; +let + version = "9"; + + inherit (python3.pkgs) python pygobject3 requests; +in stdenv.mkDerivation rec { + name = "chrome-gnome-shell-${version}"; + + src = fetchurl { + url = "mirror://gnome/sources/chrome-gnome-shell/${version}/${name}.tar.xz"; + sha256 = "0j6lzlp3jvkpnkk8s99y3m14xiq94rjwjzy2pbfqgv084ahzmz8i"; }; - buildInputs = [ gnome3.gnome_shell makeWrapper jq dbus gobjectIntrospection - python python27Packages.requests python27Packages.pygobject3 wrapGAppsHook]; - - preConfigure = '' - mkdir build usr etc - cd build - ${cmake}/bin/cmake -DCMAKE_INSTALL_PREFIX=$out/usr -DBUILD_EXTENSION=OFF ../ - substituteInPlace cmake_install.cmake --replace "/etc" "$out/etc" - ''; - - postInstall = '' - rm $out/etc/opt/chrome/policies/managed/chrome-gnome-shell.json - rm $out/etc/chromium/policies/managed/chrome-gnome-shell.json - wrapProgram $out/usr/bin/chrome-gnome-shell \ - --prefix PATH : '"${dbus}/bin"' \ - --prefix PATH : '"${gnome3.gnome_shell}/bin"' \ - --prefix PYTHONPATH : "$PYTHONPATH" + nativeBuildInputs = [ cmake ninja jq wrapGAppsHook ]; + buildInputs = [ gnome3.gnome_shell python pygobject3 requests ]; + preConfigure = '' + substituteInPlace CMakeLists.txt --replace "/etc" "$out/etc" ''; + # cmake setup hook changes /etc/opt into /var/empty + dontFixCmake = true; + cmakeFlags = [ "-DBUILD_EXTENSION=OFF" ]; + wrapPrefixVariables = [ "PYTHONPATH" ]; + + meta = with stdenv.lib; { + description = "GNOME Shell integration for Chrome"; + longDescription = '' + To use the integration, install the browser extension, and then set to true. For Firefox based browsers, you will also need to build the wrappers with set to true. + ''; + license = licenses.gpl3; + maintainers = gnome3.maintainers; + platforms = platforms.linux; + }; }