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

nixos/doc/gnome: Document how python nautilus extensions work #240780

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

doronbehar
Copy link
Contributor

Description of changes
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@doronbehar doronbehar requested a review from jtojnar June 30, 2023 18:54
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nautilus-extension-not-working/12072/14

Comment on lines 131 to 129
Some of these extensions, also include `gsettings` schemas, and adding them to `systemPackages` won't make them visible in `dconf-editor` or when you run `gsettings set`. An example of such an extension is yet again `nautilus-open-any-terminal`. Hence for this example, you have to add it in two places:

```nix
environment.systemPackages = with pkgs; [
gnome.nautilus-python
nautilus-open-any-terminal
];
services.xserver.desktopManager.gnome.extraGSettingsOverridePackages = with pkgs; [
nautilus-open-any-terminal
];
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably go to a separate section, as it is not specific to GNOME extensions. Though we will hopefully remove the option soon in favour of dconf module so perhaps it is not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably go to a separate section, as it is not specific to GNOME extensions.

Agree. I added that to the examples subsection.

Though we will hopefully remove the option soon in favour of dconf module so perhaps it is not needed.

Ideally :) But until then, let's document what is the current behavior...

@@ -116,6 +116,37 @@ Unfortunately, we lack a way for these to be managed in a completely declarative
So you have to enable them manually with an Extensions application.
It is possible to use a [GSettings override](#sec-gnome-gsettings-overrides) for this on `org.gnome.shell.enabled-extensions`, but that will only influence the default value.

## Nautilus Extensions {#sec-gnome-nautilus-extensions}

Nautilus extensions can add additional functionality to Nautilus, usually via the right-click menu. Some of these extensions are dynamically loaded from `$NAUTILUS_4_EXTENSIONS_DIR` environment variable, which is automatically set if [](#opt-services.gnome.core-utilities.enable) is true (enabled by default if gnome is enabled).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The environment variable is an implementation detail so I am not sure we should expose it. Ideally, we would drop it in favour of Nautilus wrapper package.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should have a Nautilus module in the meanwhile.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The environment variable is an implementation detail so I am not sure we should expose it.

I won't mind if it won't be exposed, but I think it's nice to have this mentioned as this way users can ls -l $NAUTILUS_4_EXTENSIONS_DIR and see what extensions they have installed... Also, they can override that value with something else if they wish to.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should have a Nautilus module in the meanwhile.

Again, until then...

nixos/modules/services/x11/desktop-managers/gnome.md Outdated Show resolved Hide resolved
nixos/modules/services/x11/desktop-managers/gnome.md Outdated Show resolved Hide resolved
];
```

In fact, any package that includes a python script at `/share/nautilus-python/extensions`, will provide a nautilus Python extension. Other examples include:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should also have a nautilus-python module that adds this to pathsToLink.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That addition to pathsToLink is already made if services.gnome.core-utilities is enabled. Perhaps this behavior should be documented as well?

Copy link
Contributor Author

@doronbehar doronbehar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review @jtojnar. Regarding many of your comments that prospect about improving the module - I really think they are good ideas, but in the meantime the current behavior is not documented so maybe we can postpone them to a later time? Perhaps after this PR, users will read the current state of things and will consider improving the situation via a nautilus wrapper and a module, and dconf module.

];
```

In fact, any package that includes a python script at `/share/nautilus-python/extensions`, will provide a nautilus Python extension. Other examples include:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That addition to pathsToLink is already made if services.gnome.core-utilities is enabled. Perhaps this behavior should be documented as well?

nixos/modules/services/x11/desktop-managers/gnome.md Outdated Show resolved Hide resolved
Comment on lines 131 to 129
Some of these extensions, also include `gsettings` schemas, and adding them to `systemPackages` won't make them visible in `dconf-editor` or when you run `gsettings set`. An example of such an extension is yet again `nautilus-open-any-terminal`. Hence for this example, you have to add it in two places:

```nix
environment.systemPackages = with pkgs; [
gnome.nautilus-python
nautilus-open-any-terminal
];
services.xserver.desktopManager.gnome.extraGSettingsOverridePackages = with pkgs; [
nautilus-open-any-terminal
];
```
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably go to a separate section, as it is not specific to GNOME extensions.

Agree. I added that to the examples subsection.

Though we will hopefully remove the option soon in favour of dconf module so perhaps it is not needed.

Ideally :) But until then, let's document what is the current behavior...

nixos/modules/services/x11/desktop-managers/gnome.md Outdated Show resolved Hide resolved
@@ -116,6 +116,37 @@ Unfortunately, we lack a way for these to be managed in a completely declarative
So you have to enable them manually with an Extensions application.
It is possible to use a [GSettings override](#sec-gnome-gsettings-overrides) for this on `org.gnome.shell.enabled-extensions`, but that will only influence the default value.

## Nautilus Extensions {#sec-gnome-nautilus-extensions}

Nautilus extensions can add additional functionality to Nautilus, usually via the right-click menu. Some of these extensions are dynamically loaded from `$NAUTILUS_4_EXTENSIONS_DIR` environment variable, which is automatically set if [](#opt-services.gnome.core-utilities.enable) is true (enabled by default if gnome is enabled).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The environment variable is an implementation detail so I am not sure we should expose it.

I won't mind if it won't be exposed, but I think it's nice to have this mentioned as this way users can ls -l $NAUTILUS_4_EXTENSIONS_DIR and see what extensions they have installed... Also, they can override that value with something else if they wish to.

@@ -116,6 +116,37 @@ Unfortunately, we lack a way for these to be managed in a completely declarative
So you have to enable them manually with an Extensions application.
It is possible to use a [GSettings override](#sec-gnome-gsettings-overrides) for this on `org.gnome.shell.enabled-extensions`, but that will only influence the default value.

## Nautilus Extensions {#sec-gnome-nautilus-extensions}

Nautilus extensions can add additional functionality to Nautilus, usually via the right-click menu. Some of these extensions are dynamically loaded from `$NAUTILUS_4_EXTENSIONS_DIR` environment variable, which is automatically set if [](#opt-services.gnome.core-utilities.enable) is true (enabled by default if gnome is enabled).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should have a Nautilus module in the meanwhile.

Again, until then...

@doronbehar doronbehar force-pushed the doc/gnome-nautilus-extensions branch from 9c966ff to bd9f6e6 Compare June 30, 2023 21:05
@doronbehar doronbehar changed the title nixos/doc/gnome: Document how python nautilus extensions nixos/doc/gnome: Document how python nautilus extensions work Jul 23, 2023
@doronbehar doronbehar force-pushed the doc/gnome-nautilus-extensions branch from bd9f6e6 to 2ba46e2 Compare July 23, 2023 14:49
@doronbehar doronbehar requested a review from jtojnar July 23, 2023 14:49
@doronbehar
Copy link
Contributor Author

Just fixed the phrasing of the commit title...

@doronbehar doronbehar added 8.has: documentation 6.topic: documentation Meta-discussion about documentation and its workflow labels Jul 28, 2023
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/documenting-bugs-and-interfaces-worth-improving-in-nixpkgs-and-nixos/30884/4

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

Successfully merging this pull request may close these issues.

None yet

5 participants