hyprwm / hyprland-plugins

Official plugins for Hyprland
BSD 3-Clause "New" or "Revised" License
564 stars 60 forks source link

[Nix] Plugins unable to be loaded #193

Open CmrCrabs opened 4 months ago

CmrCrabs commented 4 months ago

Using the hyprland flake, everything is up to date. Plugin builds completely fine and adding it as a plugin works, but once you actually try to use it in a way where it would actually be loaded, it breaks. IE if I used borders plus plus with border size set to zero, it runs fine - but If i set any actual border size it errors with

Failed to load the following plugin: /nix/store/(hash)-borders-plus-plus-0.1/lib/libborders-plus-plus.so

Same exact error (with corresponding plugin.so) occurs for all the plugins in this repo, & other third party ones I have tried. I have tried various hyprland versions with the plugin version following the hyprland version, but will still result in same error.

fufexan commented 3 months ago

Does it still happen?

CmrCrabs commented 3 months ago

Just updated all my flake inputs, rebuilt, and yes it does still happen. Same error occurs but with a new popup error being:

Failure in initialization: Version Mismatch (headers ver is not equal to running hyprland ver)

confused as to why its saying that though, as per my flake the inputs are all following the hyprland version - checking the flake.lock, both hyprland-plugins & hyprland are on the most recent commit rev.

CmrCrabs commented 3 months ago

also, the popup error will infinetly popup until i update my config, is this intended?

https://github.com/user-attachments/assets/7ee05076-7621-42d0-8c21-35b5fcd458e4

(apparently firefox wont let the video play but it works fine on chromium / when downloaded?)

jcmsj commented 3 months ago

I solved this by assigning package:

wayland.windowManager.hyprland = {
    enable = true;
    # here
    package = inputs.hyprland.packages.${pkgs.system}.hyprland; 
   # hyprexpo works
    plugins = [
      inputs.hyprland-plugins.packages.${pkgs.system}.hyprexpo
    ];
};

Almost the same as in the nixos configuration flake guide

example in my config

There's an edge case that happened to me that i think should be documented when moving hyprland from the system configuration to the hm one: If the user is using the hyprland version from the input, then the user rebuilds, it will be correct since obviously the correct hyprland version is currently running. However, in the next boot, the version specified in the default package would be used which is causing the mismatch.

also, the popup error will infinitely popup until i update my config, is this intended?

This was annoying too

I hope this works for you

CmrCrabs commented 3 months ago

sorry for late response, I updated my configuration to be in line with yours, and then tested hyprexpo and hyprbars again.

Interestingly, hyprexpo doesnt cause the constant flashing notifications, nor reloads the red banner notification (but the error message itself is the same). Behaviour hasnt changed when trying to use either plugin though, as they still dont seem to work?

Given that its working for you though I'm assuming its an error on my end.

Have just spent a few hours more on this, and if I cant figure out the solution anytime soon ill close this issue (since seemingly its a skill issue on my part).

fufexan commented 3 months ago

@CmrCrabs can you check your flake using nix-melt?

CmrCrabs commented 3 months ago

@fufexan not sure what I'm looking for exactly but I dont see anything out of the ordinary?

relevant output: image

image

fufexan commented 3 months ago

can you check whether hyprland-plugins actually has hyprland -> hyprland?

CmrCrabs commented 3 months ago

it does at the top image

fufexan commented 3 months ago

Hm, that looks good.

CmrCrabs commented 3 months ago

Could it be something to do with assigning hyprland in both my configuration.nix and home manager setup?

Currently I have the nixos module:

  programs.hyprland = {
    enable = true;3
    package = inputs.hyprland.packages.${pkgs.system}.hyprland;
  };

and then the home manager module

    wayland.windowManager.hyprland = {
    enable = true;
    systemd.enable = true;
    xwayland.enable = true;
    # package = inputs.hyprland.packages.${pkgs.system}.hyprland;

    plugins = [
      # inputs.hyprland-plugins.packages."${pkgs.system}".hyprbars
      # inputs.hyprland-plugins.packages."${pkgs.system}".borders-plus-plus
      # inputs.hyprspace.packages.${pkgs.system}.Hyprspace
    ];

    settings = {
    # ...

Note that setting a package in the wayland.windowManager option seems to break hyprland (I am unable to launch it from tty)

CmrCrabs commented 3 months ago

After removing the nixos module and then rebuilding, hyprland launches but seemingly is broken? (im assuming there is some various things that are not initialised properly).

Unsure though since @jcmsj 's config has the program.hyprland module commented, and only the wayland.windowManager module?

fufexan commented 3 months ago

programs.hyprland should only be needed for the Hyprland session to show up in display managers. I can't say for sure why you can't launch Hyprland in tty when setting its package through the HM module. Can you post some logs?

CmrCrabs commented 3 months ago

When not using the programs.hyprland option I found that dbus isnt starting correctly(?) per an AGS error message:

(com.github.Aylur.ags:25195): Gdk-WARNING **: 13:37:59.606: Failed to read portal settings: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop

unsure which part of the crash report is relevant so I will add all of it.

hyprlandCrashReport34681.txt

fufexan commented 3 months ago

Oh, it might be that the portals aren't set up properly/at all in the HM module.

CmrCrabs commented 3 months ago

would explain alot, as I was having quite a few issues with some xdg related things like opening links in application. I had to manually install xdg-utils from nixpkgs since neither the programs.hyprland option nor the HM module gets it as a dependency

for reference, I do have some xdg related configurations, although even considering that, It wasnt working without the programs.hyprland option

  xdg = {
    autostart.enable = true;
    portal = {
      enable = true;
      extraPortals = [
        pkgs.xdg-desktop-portal
        pkgs.xdg-desktop-portal-gtk
      ];
    };
  };
fufexan commented 3 months ago

Adding

xdg.portal = {
  enable = true;
  extraPortals = [config.wayland.windowManager.hyprland.package];
  configPackages = [config.wayland.windowManager.hyprland.package];
}

to your HM config should make everything work again. In the meantime I'm going to make this change upstream.

CmrCrabs commented 3 months ago

removed my old xdg config and added that to my configuration, did not seem to fix it? getting the same error as before

fufexan commented 3 months ago

Odd, did you reboot?

CmrCrabs commented 3 months ago

yep, rebuilt both nixos and hm then rebooted for good luck and nothing. Also note that a few other things didnt work like some workspace rules (to open apps) but I think those stem from the same issue with the portals

fufexan commented 3 months ago

I've created a PR here.

CmrCrabs commented 3 months ago

per this wiki entry there are quite a few other (seemingly important) things the nixos module enables, is the intention to have the hm module usable without enabling the nix module?

noamsto commented 3 months ago

@CmrCrabs I had the exact same issue, and looking at your config seems that like me, you overlooked the following flake instruction (hm installation - choose flake):

      modules = [
        hyprland.homeManagerModules.default    <--- THIS
        {
          wayland.windowManager.hyprland.enable = true;
        }

It solved my issues with plugins :)

@fufexan , BTW I'm spending so much time on your dotfiles, you did a great job, I'm copying way too much.

CmrCrabs commented 3 months ago

@noamsto I have just added to that to my config and rebuilt - still getting an identical error. Just now went through and checked my config against the wiki once more and I cant find anything else that I missed?

my one guess as to why its still not working is that, per below, I am also including inputs in extraSpecialArgs. This probably re-includes hyprland and may somehow lead to the versioning error?

outputs = { self, nixpkgs, home-manager,nur, hyprland, ... }@inputs:
let 
  lib = nixpkgs.lib;
  system = "x86_64-linux";
  pkgs = nixpkgs.legacyPackages.${system};
  in {

  nixosConfigurations.zyn-nixos = lib.nixosSystem {
    inherit system;
    modules = [ 
      nur.nixosModules.nur
      ./nixos/configuration.nix
    ];
    specialArgs = { inherit inputs; };
  };

  homeConfigurations.zyn = home-manager.lib.homeManagerConfiguration {
    inherit pkgs;
    modules = [
      hyprland.homeManagerModules.default
      {
        wayland.windowManager.hyprland.enable = true;
      }
      ./home/home.nix 
    ]; 
    extraSpecialArgs = { inherit inputs; };
  };
};

maybe @fufexan would be able to better advise?

thanks for the help either way

fufexan commented 3 months ago

Let me check if it works for me without including the upstream modules.

fufexan commented 3 months ago

Using this patch, everything is still fine

diff --git a/home/programs/wayland/hyprland/default.nix b/home/programs/wayland/hyprland/default.nix
index ed720b7..134ef76 100644
--- a/home/programs/wayland/hyprland/default.nix
+++ b/home/programs/wayland/hyprland/default.nix
@@ -7,7 +7,7 @@
   cursorPackage = inputs.self.packages.${pkgs.system}.bibata-hyprcursor;
 in {
   imports = [
-    inputs.hyprland.homeManagerModules.default
+    # inputs.hyprland.homeManagerModules.default
     ./binds.nix
     ./rules.nix
     ./settings.nix
@@ -23,6 +23,8 @@ in {
   wayland.windowManager.hyprland = {
     enable = true;

+    package = inputs.hyprland.packages.${pkgs.system}.default;
+
     plugins = with inputs.hyprland-plugins.packages.${pkgs.system}; [
       hyprbars
       hyprexpo
diff --git a/system/programs/hyprland.nix b/system/programs/hyprland.nix
index eee752d..0a73bb8 100644
--- a/system/programs/hyprland.nix
+++ b/system/programs/hyprland.nix
@@ -1,10 +1,19 @@
-{inputs, ...}: {
-  imports = [
-    inputs.hyprland.nixosModules.default
-  ];
+{
+  inputs,
+  pkgs,
+  ...
+}: {
+  # imports = [
+  #   inputs.hyprland.nixosModules.default
+  # ];

   environment.variables.NIXOS_OZONE_WL = "1";

   # enable hyprland and required options
-  programs.hyprland.enable = true;
+  programs.hyprland = {
+    enable = true;
+
+    package = inputs.hyprland.packages.${pkgs.system}.default;
+    portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland;
+  };
 }

I'm almost certain that any issues that occur are either due to improperly set packages, or wrong .follows.