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:
# Install gschemas, if any, in a package-specific directory
glibPreInstallPhase() {
makeFlagsArray+=("gsettingsschemadir=${!outputLib}/share/gsettings-schemas/$name/glib-2.0/schemas/")
}
preInstallPhases+=" glibPreInstallPhase"
glibPreFixupPhase() {
# Move gschemas in case the install flag didn't help
if [ -d "$prefix/share/glib-2.0/schemas" ]; then
mkdir -p "${!outputLib}/share/gsettings-schemas/$name/glib-2.0"
mv "$prefix/share/glib-2.0/schemas" "${!outputLib}/share/gsettings-schemas/$name/glib-2.0/"
fi
addToSearchPath GSETTINGS_SCHEMAS_PATH "${!outputLib}/share/gsettings-schemas/$name"
}
# gappsWrapperArgsHook expects GSETTINGS_SCHEMAS_PATH variable to be set by this.
# Until we have dependency mechanism in generic builder, we need to use this ugly hack.
if [[ " ${preFixupPhases:-} " =~ " gappsWrapperArgsHook " ]]; then
preFixupPhases+=" "
preFixupPhases="${preFixupPhases/ gappsWrapperArgsHook / glibPreFixupPhase gappsWrapperArgsHook }"
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
jtojnar
November 30, 2022, 12:57pm
11
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 !
It would have been great if this was documented, your review is welcome at:
NixOS:master
â doronbehar:doc/gnome-nautilus-extensions
opened 06:54PM - 30 Jun 23 UTC
###### 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](https://nixos.org/manual/nix/stable/command-ref/conf-file.html))
- [ ] Tested, as applicable:
- [NixOS test(s)](https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests) (look inside [nixos/tests](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))
- and/or [package tests](https://nixos.org/manual/nixpkgs/unstable/#sec-package-tests)
- or, for functions and "core" functionality, tests in [lib/tests](https://github.com/NixOS/nixpkgs/blob/master/lib/tests) or [pkgs/test](https://github.com/NixOS/nixpkgs/blob/master/pkgs/test)
- made sure NixOS tests are [linked](https://nixos.org/manual/nixpkgs/unstable/#ssec-nixos-tests-linking) to the relevant packages
- [ ] 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](https://github.com/Mic92/nixpkgs-review#usage)
- [ ] Tested basic functionality of all binary files (usually in `./result/bin/`)
- [23.11 Release Notes](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2311.section.md) (or backporting [23.05 Release notes](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2305.section.md))
- [ ] (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](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
<!--
To help with the large amounts of pull requests, we would appreciate your
reviews of other pull requests, especially simple package updates. Just leave a
comment describing what you have tested in the relevant package/service.
Reviewing helps to reduce the average time-to-merge for everyone.
Thanks a lot if you do!
List of open PRs: https://github.com/NixOS/nixpkgs/pulls
Reviewing guidelines: https://nixos.org/manual/nixpkgs/unstable/#chap-reviewing-contributions
-->
1 Like
TLouf
August 22, 2023, 1:21pm
15
Thanks for sharing your solution, I managed to make it work on my end too
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?
TLouf
August 22, 2023, 8:20pm
17
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.
TLouf
August 24, 2023, 10:23am
19
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!