NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.49k stars 12.99k forks source link

`gnomeExtensions.gtk4-desktop-icons-ng-ding` broken on NixOS 23.11 #274129

Open ajgrf opened 6 months ago

ajgrf commented 6 months ago

Describe the bug

The GNOME Shell extension gnomeExtensions.gtk4-desktop-icons-ng-ding doesn't seem to work on the latest NixOS 23.11 release.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Install GNOME Shell and gnomeExtensions.gtk4-desktop-icons-ng-ding on NixOS 23.11 (or probably NixOS unstable as well).
  2. Activate the extension.

Expected behavior

Icons should appear on the desktop.

Additional context

Opening the extension settings produces the following error:

The settings of extension gtk4-ding@smedius.gitlab.com had an error:

TypeError: settings is null

Stack trace:

addActionRowSelector@file:///home/alex/.nix-profile/share/gnome-shell/extensions/gtk4-ding@smedius.gitlab.com/app/adwPreferencesWindow.js:303:9
getAdwPreferencesWindow@file:///home/alex/.nix-profile/share/gnome-shell/extensions/gtk4-ding@smedius.gitlab.com/app/adwPreferencesWindow.js:253:29
fillPreferencesWindow@file:///home/alex/.nix-profile/share/gnome-shell/extensions/gtk4-ding@smedius.gitlab.com/prefs.js:41:27
_loadPrefs@resource:///org/gnome/Shell/Extensions/js/extensionPrefsDialog.js:36:18
async*_init@resource:///org/gnome/Shell/Extensions/js/extensionPrefsDialog.js:21:14
ExtensionPrefsDialog@resource:///org/gnome/Shell/Extensions/js/extensionPrefsDialog.js:12:4
OpenExtensionPrefsAsync@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:139:33
async*_handleMethodCall@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:373:35
_wrapJSObject/<@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:408:34
_init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34

Notify maintainers

@piegamesde @jtojnar @4JX

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.65, NixOS, 23.11 (Tapir), 23.11.20231207.b4372c4`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"nixos-22.11"`
 - nixpkgs: `/nix/store/vdap779dm1xfpr35xvfb9a1yiqiw9n89-source`

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

4JX commented 6 months ago

Afaik this comes from the GNOME 45 extensions upgrade that removes this bit https://github.com/NixOS/nixpkgs/commit/fc495aea1faba0c33055011ec6df963571717684#diff-a93586f7df89823a97c3e23088ceca4e124bc952d9f38d0f6522b58689ab0f34L100-L107

Will quickly test and report back Right, so patching that solves half the issue, but now there's some wrapper weirdness going on here due to the wrapGApp bit as the shebang isn't correctly set from #!/usr/bin/env -S gjs -m: ding.js

...
# ------------------------------------------------------------------------------------
# The C-code for this binary wrapper has been generated using the following command:
...
# (Use `nix-shell -p makeBinaryWrapper` to get access to makeCWrapper in your shell)
# ------------------------------------------------------------------------------------
....

.ding.js-wrapped

#!/nix/store/zx8aqgdy735qzk81glfwil6mbi6ddqb1-coreutils-9.4/bin/env -S  -m
ajgrf commented 6 months ago

Thanks for looking into this, @4JX. Did you manage to get the extension working, or is the shebang problem you mentioned still unsolved? Would you mind pushing your changes to GitHub (even if they're not ready for a PR)?

4JX commented 6 months ago

Shebang issue is a problem that I've yet to solve should the "fix" proceed by un-removing the patch section, using this branch for testing.

I need to toy around with wrapGApp as I've not used it before, as I cannot rule whether the wrapper itself might be broken or if maybe something else is going on, given that the only other extension to use that still manually fixes the gjs paths beforehand.

cc @piegamesde, can you explain were the changes meant to do?

piegamesde commented 6 months ago

Uhm, I think I'll have to delegate this up the competence chain, CC @jtojnar

But as far as I understand, wrapGApp only fixes shebangs, and if the code inside the script does something inappropriate it still needs to be patched manually. That's what the other extension does: its script internally does an exec gjs of which the path needs to be fixed.

jtojnar commented 6 months ago

But as far as I understand, wrapGApp only fixes shebangs, and if the code inside the script does something inappropriate it still needs to be patched manually. That's what the other extension does: its script internally does an exec gjs of which the path needs to be fixed.

The part about shebangs is incorrect, it does not touch shebangs at all – it creates a new executable file in place of the original one that invokes the original one with extra environment variables.

Notably, the new file on that path (the wrapper) will no longer be a JS file, which causes issues when the extension assumes the original file is a script and tries to execute gjs path/to/file.js,

4JX commented 6 months ago

Updated the commit, currently at:

Dec 18 22:21:32 terra gnome-shell[3042]: Gtk4-DING: (gjs:10813): GLib-CRITICAL **: 22:21:32.719: g_once_init_leave: assertion 'result != 0' failed
Dec 18 22:21:32 terra gnome-shell[3042]: Gtk4-DING: (gjs:10813): GLib-GObject-CRITICAL **: 22:21:32.719: cannot add private field to invalid (non-instantiatable) type '<invalid>'
Dec 18 22:21:32 terra gnome-shell[3042]: Gtk4-DING: (gjs:10813): GLib-GObject-CRITICAL **: 22:21:32.719: cannot register existing type 'GCancellable'
Dec 18 22:21:32 terra gnome-shell[3042]: Gtk4-DING: (gjs:10813): GLib-GObject-CRITICAL **: 22:21:32.719: g_param_spec_pool_lookup: assertion 'pool != NULL' failed
Dec 18 22:21:32 terra gnome-shell[3042]: Gtk4-DING: (gjs:10813): GLib-GObject-CRITICAL **: 22:21:32.719: g_param_spec_pool_insert: assertion 'pool != NULL' failed
Dec 18 22:21:32 terra gnome-shell[3042]: Gtk4-DING: (gjs:10813): GLib-GObject-CRITICAL **: 22:21:32.719: g_param_spec_pool_lookup: assertion 'pool != NULL' failed

Which escapes my realm of knowledge. Might be related to my QT/GTK hacked together setup but that's just speculation on my part.

Freed-Wu commented 5 months ago

The latest version of gtk4-desktop-icons-ng-ding is 70. Can updating to latest fix it?

4JX commented 5 months ago

Seems like that did the trick, there's still

Jan 20 00:27:07 terra .gnome-shell-wr[2433988]: Gtk4-DING: GNOME nautilus 45.2.1
Jan 20 00:27:07 terra .gnome-shell-wr[2433988]: Gtk4-DING: ** Message: 00:27:07.327: Connecting to org.freedesktop.Tracker3.Miner.Files
Jan 20 00:27:07 terra .file-roller-wr[2435276]: Using GtkSettings:gtk-application-prefer-dark-theme together with HdyStyleManager is unsupported. Please use HdyStyleManager:color-scheme instead.
Jan 20 00:27:07 terra .gnome-shell-wr[2433988]: Gtk4-DING:   _init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34
Jan 20 00:27:07 terra .gnome-shell-wr[2433988]: Gtk4-DING:   @file:///nix/store/5l84jh85bvg60a93p5a1254s24lgycd0-gnome-shell-extension-gtk4-desktop-icons-ng-ding-70/share/gnome-shell/extensions/gtk4-ding@smedius.gitlab.com/app/.ding.js-wrapped:258:21
Jan 20 00:27:07 terra .gnome-shell-wr[2433988]: Gtk4-DING:   @file:///nix/store/5l84jh85bvg60a93p5a1254s24lgycd0-gnome-shell-extension-gtk4-desktop-icons-ng-ding-70/share/gnome-shell/extensions/gtk4-ding@smedius.gitlab.com/app/.ding.js-wrapped:238:26
Jan 20 00:27:07 terra .gnome-shell-wr[2433988]: Gtk4-DING:   DesktopManager@file:///nix/store/5l84jh85bvg60a93p5a1254s24lgycd0-gnome-shell-extension-gtk4-desktop-icons-ng-ding-70/share/gnome-shell/extensions/gtk4-ding@smedius.gitlab.com/app/desktopManager>
Jan 20 00:27:07 terra .gnome-shell-wr[2433988]: Gtk4-DING:   init@file:///nix/store/5l84jh85bvg60a93p5a1254s24lgycd0-gnome-shell-extension-gtk4-desktop-icons-ng-ding-70/share/gnome-shell/extensions/gtk4-ding@smedius.gitlab.com/app/preferences.js:143:14
Jan 20 00:27:07 terra .gnome-shell-wr[2433988]: Gtk4-DING:   _monitorTerminalSettings@file:///nix/store/5l84jh85bvg60a93p5a1254s24lgycd0-gnome-shell-extension-gtk4-desktop-icons-ng-ding-70/share/gnome-shell/extensions/gtk4-ding@smedius.gitlab.com/app/pref>
Jan 20 00:27:07 terra .gnome-shell-wr[2433988]: Gtk4-DING:   _updateTerminalSettings@file:///nix/store/5l84jh85bvg60a93p5a1254s24lgycd0-gnome-shell-extension-gtk4-desktop-icons-ng-ding-70/share/gnome-shell/extensions/gtk4-ding@smedius.gitlab.com/app/prefe>
Jan 20 00:27:07 terra .gnome-shell-wr[2433988]: Gtk4-DING: (gjs:2435259): Gjs-WARNING **: 00:27:07.295: Unhandled promise rejection. To suppress this warning, add an error handler to your promise chain with .catch() or a try-catch block around your await >
Jan 20 00:27:07 terra .gnome-shell-wr[2433988]: Gtk4-DING: Gjs-Console-Message: 00:27:07.291: Detected async api for thumbnails
Jan 20 00:27:07 terra .gnome-shell-wr[2433988]: com.desktop.dingextension DBus Name Acquired
Jan 20 00:27:07 terra .gnome-shell-wr[2433988]: gtk4-DING enabled.
Jan 20 00:27:07 terra .gnome-shell-wr[2433988]: Launching Gtk4-DING process

But it doesn't seem nixos related and the extension appears to work image

Nixpkgs branch: https://github.com/4JX/nixpkgs/tree/gtk4-ding70 And personal setup commit: https://github.com/4JX/nixos-config/commit/102de5557ea07e1f581c779dd07ccfb2d2f2aa90

4JX commented 5 months ago

Will make a proper PR once https://github.com/NixOS/nixpkgs/pull/282143/ is merged, as it contains the necessary version update

Thatoo commented 2 months ago

Would it work now?

4JX commented 2 months ago

Would it work now?

It should (mostly), though there's always the possibility of something breaking as new updates come along. Feel free to report any issues.

Thatoo commented 2 months ago

To make settings work, I had to add gjs to environment.systemPackages. NOw settings don't show any error but nothing appear on desktop still (even after reboot). I read on gitlab that I should also add

  services.xserver.desktopManager.gnome.extraGSettingsOverridePackages = with pkgs; [
    gnome.nautilus # needed for gtk4-desktop-icons-ng-ding gnome extension
    #gnome.mutter # should not be needed
    #gtk4 # should not be needed
  ];

but it didn't help neither. Should I uncomment gnome.mutter and gtk4?

4JX commented 2 months ago

Sounds like you are installing the extension via the extension manager? You should be using gnomeExtensions.gtk4-desktop-icons-ng-ding

Thatoo commented 2 months ago

Here is how I installed it :

{ config, pkgs, lib, inputs, ... }:
  environment.systemPackages = with pkgs; [
    gnomeExtensions.gtk4-desktop-icons-ng-ding
    gjs # needed for gtk4-desktop-icons-ng-ding
  ];

and I tried with that also, but now it's commented and I don't see the difference :

#  services.xserver.desktopManager.gnome.extraGSettingsOverridePackages = with pkgs; [
#    gnome.nautilus # needed for gtk4-desktop-icons-ng-ding gnome extension
    #gnome.mutter # should not be needed
    #gtk4 # should not be needed
#  ];
Thatoo commented 2 months ago

anyway, 23.11 is over soon so maybe it will work with 24.05 and version 71 (instead of version 68 in 23.11).

4JX commented 2 months ago

anyway, 23.11 is over soon so maybe it will work with 24.05 and version 71 (instead of version 68 in 23.11)

Ah, that confirms my other hunch.

The patch was made against version 70 (now at 71, but should still work), which means the stable nixos branch doesnt have the required changes, as usually there aren't backports for extension updates/fixes.

You should be able to pull the extension packages from nixos-unstable while keeping your overall system on 23.11 if that floats your boat. Flake inputs are best for this, instead of using overlays.

Or you can also just wait till a new release is made, though then you'll again be behind on extensions updates till the next release.

17314642 commented 2 months ago

@4JX

Hi, I am using this extension from unstable channel and it's version is currently 73, but it still doesn't work for me. What can I try to do to fix it?

Apr 18 16:45:43 ms-7d48 .gnome-shell-wr[7951]: gtk4-DING enabled.
Apr 18 16:45:43 ms-7d48 .gnome-shell-wr[7951]: com.desktop.dingextension DBus Name Acquired
Apr 18 16:45:43 ms-7d48 .gnome-shell-wr[7951]: Gtk4-DING: (gjs:12464): GLib-GObject-CRITICAL **: 16:45:43.272: g_param_spec_pool_lookup: assertion 'pool != NULL' failed
Apr 18 16:45:43 ms-7d48 .gnome-shell-wr[7951]: Gtk4-DING: (gjs:12464): GLib-GObject-CRITICAL **: 16:45:43.272: g_param_spec_pool_insert: assertion 'pool != NULL' failed
Apr 18 16:45:43 ms-7d48 .gnome-shell-wr[7951]: Gtk4-DING: (gjs:12464): GLib-GObject-CRITICAL **: 16:45:43.272: g_param_spec_pool_lookup: assertion 'pool != NULL' failed
Apr 18 16:45:43 ms-7d48 .gnome-shell-wr[7951]: Gtk4-DING: (gjs:12464): GLib-GObject-CRITICAL **: 16:45:43.272: cannot register existing type 'GCancellable'
Apr 18 16:45:43 ms-7d48 .gnome-shell-wr[7951]: Gtk4-DING: (gjs:12464): GLib-GObject-CRITICAL **: 16:45:43.272: cannot add private field to invalid (non-instantiatable) type '<invalid>'
Apr 18 16:45:43 ms-7d48 .gnome-shell-wr[7951]: Gtk4-DING: (gjs:12464): GLib-CRITICAL **: 16:45:43.272: g_once_init_leave: assertion 'result != 0' failed
4JX commented 2 months ago

Hi, I am using this extension from unstable channel and it's version is currently 73, but it still doesn't work for me. What can I try to do to fix it?

No idea, I myself got stuck there before.

PS: To the people following this thread I do not actively use this extension, but the fixes in the past have been easy enough that I could tackle them as part of my own housekeeping. Would appreciate if someone else took over looking at this.

Andreas02-dev commented 2 months ago

@4JX

Thanks for your help, especially since you don't actively use the extension! It seems the extension from Unstable (rev 25865a40d14b3f9cf19f19b924e2ab4069b09588) which is version 78 and has version-name 75 doesn't work properly and shows the following error:

┌─ gnome-shell/extensions/gtk4-ding@smedius.gitlab.com  via  
└─> ./app/ding.js

(gjs:180255): Gjs-CRITICAL **: 11:47:11.842: JS ERROR: Error: Requiring Adw, version none: Typelib file for namespace 'Adw' (any version) not found
require@resource:///org/gnome/gjs/modules/esm/gi.js:16:28
@gi://Adw/:3:25

(gjs:180255): Gjs-CRITICAL **: 11:47:11.842: Module file:///home/andreas/Downloads/nixpkgs/result/share/gnome-shell/extensions/gtk4-ding@smedius.gitlab.com/app/ding.js threw an exception

Do you have any experience with this?

I've tried to modify the override to the following, but unfortunately the same issue occurs.

  (patchExtension "gtk4-ding@smedius.gitlab.com" (old: {
    nativeBuildInputs = [ wrapGAppsHook3 ];
    buildInputs = [ pkgs.libadwaita ];
    patches = [
      (substituteAll {
        inherit gjs util-linux xdg-utils;
        util_linux = util-linux;
        xdg_utils = xdg-utils;
        src = ./extensionOverridesPatches/gtk4-ding_at_smedius.gitlab.com.patch;
        nautilus_gsettings_path = "${glib.getSchemaPath gnome.nautilus}";
      })
    ];
  }))