NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.52k stars 13k forks source link

The `turtle` pkg's nautilus integration does not work on NixOS inside a nix-shell #319958

Closed CoderThomasB closed 2 days ago

CoderThomasB commented 3 weeks ago

Describe the bug

turtle's main feature is to add additional functionality to the gnome file explorer, nautilus, via extra icons and context menus when using nautilus to navigate inside a git repository; but when running nautilus from within a nix-shell on NixOS with turtle installed, that functionality does not seam to be working.

Steps To Reproduce

Steps to reproduce the behaviour:

  1. Run nix-shell -p turtle -p gnome.nautilus
  2. Run nautilus -q to kill any already running instances of nautilus.
  3. Run nautilus
  4. Navigate into a directory containing .git
  5. Observe that no additional icons, information, or context actions have been added to nautilus, as shown in the below screenshot from the turtle gnome GitLab.

Expected behaviour

When the turtle package is installed from either nix-shell or environment.systemPackages it's integration with nautilus functions.

Screenshot from the gnome GitLab showing nautilus with extra icons representing a file's git status: Screenshot from the gnome GitLab showing nautilus with extra icons representing a file's git status

Screenshots

A screenshot of nautilus shows a .git folder, but none of the icons added by turtle are present. Screenshot from 2024-06-15 13-24-17

Additional context

Looking at pkgs/by-name/tu/turtle/package.nix it does not appear that the gnome.nautilus-python package is listed as a dependency, but since turtle's nautilus integration is written in python that package would be required for the integration to work. This may be the reason why the integration isn't working, but I'm not sure, as when I tried using a nix-shell -p turtle -p gnome.nautilus -p gnome.nautilus-python it also didn't work. It could also be that something else about my system could be stopping it from working, and if anyone wants extra details, I'll be happy to share.

It might also be that turtle's install.py is trying to add the nautilus extension as if it was running on a mutable OS, and is trying to modify system files. Looking at the install.py there seams to be a few CLI options about installing to the user's home directory, which implies that by default it tries to install system-wide, which may be the problem. If this is the case, would what the install.py code copies into the system need to be named in the package.nix file or would a hole systemwide NixOS option in configuration.nix need to be set?

I'm new to using NixOS and if I'm doing anything wrong, please explain or point me to the relevant documentation, so I can learn.

The turtle package was added in pull request #313605

Notify maintainers

@aleksanaa @aleksana

In the package.nix the maintainer was listed as aleksana (without a second a) but that didn't look like the right GitHub user, so I'm pinging both. This may also be a problem to fix.

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.33, NixOS, 24.05 (Uakari), 24.05.1409.cc54fb41d137`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - channels(root): `"nixos-24.05"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Add a :+1: reaction to issues you find important.

Aleksanaa commented 3 weeks ago

Have you tried adding turtle, gnome.nautilus-python and gnome.nautilus to the same output path (e.g. environment.systemPackages, users.users.<someone>.packages, home.packages, or using symlinkJoin)?


My preferred ID is aleksana, but you see, someone already took it. If you want to solve the problem please negotiate with them 😅

And the maintainer's name does not necessarily equal to the GitHub ID, and if you want to find their GitHub id, you can search the package on https://search.nixos.org and click relevant maintainer link.

CoderThomasB commented 3 days ago

Sorry for the really late reply, I tried adding all of turtle, gnome.nautilus-python, and gnome.nautilus to my environment.systemPackages but still nautilus doesn't load turtle.

But now, running nautilus shows what looks to be the relevant error message:

Traceback (most recent call last):
  File "/run/current-system/sw/share/nautilus-python/extensions/turtle_nautilus.py", line 22, in <module>
    from turtlevcs.turtle_plugin import TurtlePlugin
  File "/nix/store/8jdkqwjw0kz1cc0x9bdxaf5a6rkapd62-turtle-0.8/lib/python3.11/site-packages/turtlevcs/turtle_plugin.py", line 24, in <module>
    from turtlevcs.turtle_service import TurtleServiceConnector
  File "/nix/store/8jdkqwjw0kz1cc0x9bdxaf5a6rkapd62-turtle-0.8/lib/python3.11/site-packages/turtlevcs/turtle_service.py", line 22, in <module>
    import dbus
ModuleNotFoundError: No module named 'dbus'

There's also:

Traceback (most recent call last):
  File "/run/current-system/sw/share/nautilus-python/extensions/turtle_nautilus_compare.py", line 60, in get_file_items
    if self.settings.get_boolean("show-compare"):
       ^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_boolean'

So, nautilus is finding and loading turtle, but the environment doesn't look like it includes the python dbus package, which turtle needs.

Aleksanaa commented 3 days ago

Got it. I'm updating turtle.

Aleksanaa commented 3 days ago

Upstream also made a small mistake: they didn't add dbus-python to the declared dependencies. This is fixed in 0.9.