Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native host connector for gnome extensions: init at 7d99523e90805cb65027cc2f5f1191a957dcf276 #24283

Merged
merged 1 commit into from Apr 30, 2017

Conversation

dyrnade
Copy link
Contributor

@dyrnade dyrnade commented Mar 24, 2017

Motivation for this change

In order to install gnome extensions, native host connector is needed.
This pkg works for Firefox without gnome-extension addon of Firefox.
https://wiki.gnome.org/Projects/GnomeShellIntegrationForChrome/Installation

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@joachifm
Copy link
Contributor

Needs rebase

@dyrnade
Copy link
Contributor Author

dyrnade commented Mar 30, 2017

@joachifm Rebased.

@dyrnade dyrnade changed the title native host connector for gnome extensions native host connector for gnome extensions: init at 7d99523e90805cb65027cc2f5f1191a957dcf276 Mar 31, 2017
@7c6f434c 7c6f434c merged commit a7455d7 into NixOS:master Apr 30, 2017
@jameysharp
Copy link
Contributor

Shouldn't this use -DCMAKE_INSTALL_PREFIX=$out instead of $out/usr? If you do, then (to answer @teh's question) I believe this package will work when listed in the system-wide configuration.nix in the services.dbus.packages setting. It isn't immediately obvious to me that there's any way to use it with nix-env, at least from what I can find of the current DBus packaging in nixpkgs.

In fact, if you add cmake to buildInputs, then that prefix is the default and the whole preConfigure block can be replaced with:

 cmakeFlags = "-DBUILD_EXTENSION=OFF";
 postConfigure = ''
 substituteInPlace cmake_install.cmake --replace "/etc" "$out/etc"
 '';

After doing that, I also had to remove the two rm calls from postInstall. I can't figure out why they started failing, but I also don't see what good they were doing.

I don't think the version of this package that's currently on master works as-is, but I think the above fixes should get it close.

@jameysharp
Copy link
Contributor

I found more bugs in the version of this patch that's on master: the wrapper script is not constructed correctly. I would very much like this reviewed by someone more experienced with Nix packaging than I am.

  • The wrapProgram call is missing the separator (:) arguments for the --prefix PATH flags.
  • The specified PATH prefixes don't point to directories containing programs; ${dbus}/bin/dbus should just be ${dbus}/bin and ${gnome3.gnome_shell} should be ${gnome3.gnome_shell}/bin. Although I'm not convinced that either directory actually needs to be on the PATH.
  • The program gets wrapped twice due to the use of wrapGAppsHook, which leads to infinite recursion and eventually the bash "argument list too long" error.

I still haven't gotten this to work even with all that fixed since I wanted to test it using nix-env instead of installing system-wide. My DBus session bus apparently isn't looking in ~/.nix-profile/share like the documentation says it should if the value of XDG_DATA_DIRS were available to it, so I think my gdm3 X session isn't starting it with the full environment for my profile. I guess that's a separate issue.

Here's the standalone expression I'm currently testing with. I suspect more things can be deleted from it, but since I can't fully test it I've left the buildInputs and PATH alone. However I did switch to a released version rather than a random git commit.

with import <nixpkgs> { };
  
stdenv.mkDerivation rec {
  name = "chrome-gnome-shell";
  version = "9";
  src = fetchurl {
    url = "https://git.gnome.org/browse/chrome-gnome-shell/snapshot/${name}-${version}.tar.xz";
    sha256 = "0j6lzlp3jvkpnkk8s99y3m14xiq94rjwjzy2pbfqgv084ahzmz8i";
  };

  buildInputs = [ cmake gnome3.gnome_shell makeWrapper jq dbus gobjectIntrospection
    python python27Packages.requests python27Packages.pygobject3 wrapGAppsHook];
  
  cmakeFlags = "-DBUILD_EXTENSION=OFF";
  postConfigure = ''
    substituteInPlace cmake_install.cmake --replace "/etc" "$out/etc"
  '';

  dontWrapGApps = true;
  postFixup = ''
    wrapProgram $out/bin/chrome-gnome-shell \
      --prefix PATH : '${dbus}/bin:${gnome3.gnome_shell}/bin' \
      --prefix PYTHONPATH : "$PYTHONPATH" \
      "''${gappsWrapperArgs[@]}"
  '';
}

@pierrebeaucamp
Copy link

Any idea how to get this to work, even for system wide packages? Snippet from my config:

environment.systemPackages = [ 
    pkgs.firefox-devedition-bin
];
services.dbus.packages = [ pkgs.chrome-gnome-shell ];

@alexeymuranov
Copy link
Contributor

@pierrebeaucamp, i didn't understand your question, but maybe this Unix.SE answer can help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants