Nautilus-extension not working

i am trying to install my own package. it is a simple extension for nautilus to open the terminal directly via rightclick.
My problems are:

  • the compiled gsettings schema is not found.
  • And i am unsure if the files are placed correctly.

currently my progress is this:

{ lib, pkg-config, python3Packages, dbus, dconf, gobject-introspection, fetchFromGitHub, gnome3, glib, gtk3, python3, python38Packages,
    gsettings-desktop-schemas, wrapGAppsHook }:

python3Packages.buildPythonPackage rec {
  pname = "nautilus-open-any-terminal";
  version = "0.2.10";

  src = fetchFromGitHub {
    owner = "Stunkymonkey";
    repo = "${pname}";
    rev = "c86dce4a9dc3c479d6aded3e9b72cc04dd7488fb";
    sha256 = "0xfclvmpcdz7br8sx2pi00crz6k3d1vrjc0rxlwpdhklr3nyrk92";
  };

  buildInputs = [
    gtk3
    gsettings-desktop-schemas
    gnome3.dconf
    gnome3.gobject-introspection
    gnome3.nautilus
    gnome3.nautilus-python
    dbus
    python3
    dconf
  ];

  nativeBuildInputs = [
    pkg-config
    glib
    gobject-introspection
    (python3.withPackages (ps: with ps; [
      pygobject3
    ]))
    wrapGAppsHook
  ];

  doCheck = false;

  meta = with lib; {
    description = "extension for nautilus, which adds an context-entry for opening other editor then `gnome-terminal`.";
    license = licenses.gpl3;
    maintainers = with maintainers; [ stunkymonkey ];
    homepage = "https://github.com/Stunkymonkey/nautilus-open-any-terminal";
  };
}

any suggestions? (i know that there are much more buildInputs then needed, but for now this does not hurt.)

I suspect nautilus-python loads python modules so wrapping might not work. You will need to use a patch:

https://nixos.org/manual/nixpkgs/stable/#ssec-gnome-common-issues-unwrappable-package

am i right, that i have to patch my own application? or is it the setup.py-file?
are there some python examples?

Yeah, patching the app will be necessary. Unfortunately, the GSettings API assumes there is a global location like /usr/share, where the schemas are stored, which obviously is not true in Nix land.

I am not aware of a Python example – dynamically loaded Python libraries that read GSettings schemas are rare. But the Vala example should be pretty close – it is gobject-introspection based API after all.

I finally got the schemas compiled, but dconf still can’t find them.
And I still have the issue, that the python file is not being read when nautilus starts. Not sure why.

my current progress can be seen here: https://github.com/Stunkymonkey/nixpkgs/commit/a293769c4aad72c9ef7df910b72d14f65e764fe8
any suggestions? if it helps here is the output when compiling it or maybe the resulting directory

it would also be nice to replace the python3.8-${pname}-${version} with something like ${python.version}-${pname}-${version}

You used the patch for gobject-introspection typelibs instead of the one for gsettings. It should look something like this (untested).

You can try using $name environment variable – that is what glib setup hook uses as well:

all seems better now.

i am still facing the problem, that the nautilus-extension is not being loaded. even if I insert a print statement/file creation/… it never gets shown.

for this i have to prepent it to XDG_DATA_DIRS to get loaded: source. but i do not know how to do this. i expect this the wrapGAppsHook will take care of it.

Hi @Stunkymonkey , What’s the trick to compiling the schema on NixOS? I installed it according to instructions on your github, but I can’t get to the settings. Schema does not exist. Can’t use the command in your instructions because of the path.

multiple people face this issue: [No schema found] · Issue #63 · Stunkymonkey/nautilus-open-any-terminal · GitHub
Sadly this is some kind of gnome problem. And not only related to NixOS. Not sure how to fix it.

I am getting the error as well:

$ gsettings set com.github.stunkymonkey.nautilus-open-any-terminal terminal foot
No schemas installed

That is expected, see GSettings schema of installed software not available to gsettings program or dconf-editor · Issue #33277 · NixOS/nixpkgs · GitHub

Is this package working for anyone?

I have set the following in my NixOS config:

    services.xserver.desktopManager.gnome.extraGSettingsOverridePackages = [
      pkgs.nautilus-open-any-terminal
    ];
    # Let nautilus find extensions
    environment.sessionVariables.NAUTILUS_EXTENSION_DIR = "${config.system.path}/lib/nautilus/extensions-4";

    environment.pathsToLink = [
      "/share/nautilus-python/extensions"
    ];

And I also added this package to system.environmentPackages. I don’t see anything when I right-click with the mouse in Nautilus…

I do however get to see the gsettings schemas thanks to @jtojnar’s already linked comment.

Do you also have gnome.nautilus-python in environment.systemPackages?

I didn’t, but now it works, thanks @jtojnar ! :rocket: :metal: :rocket:

It would have been great if this was documented, your review is welcome at:

1 Like

Thanks for sharing your solution, I managed to make it work on my end too :slight_smile:

Does the shortcut work for you, though? I tried with the default, or by changing it in case there was some conflict, but never managed to open my terminal with a shortcut.

Yes, but I wouldn’t call it a shortcut, but a right click menu button.

You mean default terminal?

I meant that the button does appear in the right click menu, and it works, but the shortcut to open the configured terminal from nautilus, which is configured with com.github.stunkymonkey.nautilus-open-any-terminal keybindings, does not have any effect. So what I meant by default is that I tried changing this setting to random shortcuts in case there was a conflict with Ctrl+Shift+t, but it still did not work.

Oh I wasn’t aware of that keybinding. The default keybinding doesn’t work for me as well… Perhaps it’s an upstream issue.

Ah yes, that’s indeed the case: Keybinding does not work · Issue #68 · Stunkymonkey/nautilus-open-any-terminal · GitHub

I should have looked for it, sorry and thanks again for documenting this!