shezdy / hyprsplit

hyprland plugin for separate sets of workspaces on each monitor
BSD 3-Clause "New" or "Revised" License
121 stars 7 forks source link

"Failed to load the following plugins" error in NixOs #15

Closed llazuk closed 7 months ago

llazuk commented 7 months ago

Plugin compiles hyprland somehow cannot pick it up.

When I run hyprctl plugin load manually I get the following output:

hyprctl plugin load /nix/store/57aazqsw931dz8qyz4zdpkirj74vpbla-hyprsplit-0.1/lib/libhyprsplit.so

error in loading plugin, last error: Plugin /nix/store/57aazqsw931dz8qyz4zdpkirj74vpbla-hyprsplit-0.1/lib/libhyprsplit.so could not be loaded: /nix/store/57aazqsw931dz8qyz4zdpkirj74vpbla-hyprsplit-0.1/lib/libhyprsplit.so: undefined symbol: _ZN8CMonitor17activeWorkspaceIDEv

hyprctl version

Hyprland, built from branch  at commit v0.38.1  ().
Date: 2024-04-06
Tag:

flags: (if any)

Flake input:

    hyprsplit = {
      url = "github:shezdy/hyprsplit";
      inputs.hyprland.follows = "hyprland";
    };

Let me know if you need more info!

shezdy commented 7 months ago

It looks to me like the plugin is compiled for the wrong version of Hyprland. Try

hyprsplit = {
  url = "github:shezdy/hyprsplit?ref=v0.38.1";
  inputs.hyprland.follows = "hyprland";
};
llazuk commented 7 months ago

Thanks for your help!

Unfortunately amending it breaks the entire flake.

error:
       … while updating the lock file of flake 'git+file:///home/username/dotfiles'

       … while updating the flake input 'hyprsplit'

       error: getting status of '/nix/store/6sbsi106j588hmz9fy5jyna8vdxmdq8b-source/flake.nix': No such file or directory
shezdy commented 7 months ago

Oh oops I see, nix support wasn't added to the plugin until v0.39.0. Are you using the Hyprland flake or nixpkgs unstable to get Hyprland?

If you are using the Hyprland flake you should make sure that the url of the plugin and Hyprland are using the same tag, for example:

hyprland.url = "github:hyprwm/Hyprland?ref=v0.39.1}"; # or "github:hyprwm/Hyprland" to follow the main branch

hyprsplit = {
  url = "github:shezdy/hyprsplit?ref=v0.39.1"; # or "github:shezdy/hyprsplit" to follow the main branch, ?ref={version} should always match hyprland.url version
  inputs.hyprland.follows = "hyprland";
};

If you are using Hyprland from nixpkgs, you need to first wait for Hyprland to be updated to 0.39.1 (https://github.com/NixOS/nixpkgs/pull/304725), then set hyprsplit to use the same tag as hyprland in nixpkgs like I did in the example above. I think using hyprland from nixpkgs will lead to more breakage in the future because you need to always make sure the plugin is set to the same tag as whatever is in nixpkgs.

I recommend using the Hyprland flake instead of nixpkgs if you are going to use any plugins, I think official Hyprland documentation also recommends that. I haven't used nixos on the desktop for a while, so hopefully all that info is accurate!

luiswirth commented 7 months ago

I'm on NixOS and for me this works 👍🏼

llazuk commented 7 months ago

Turns out my config didn't use nixos and home-manager module from the flake. Once I imported it by adding the below, plugin started loading. Thanks for your help.

configuration.nix

  imports = [
      ./hardware-configuration.nix
      inputs.hyprland.nixosModules.default
    ];

home.nix

  imports = [
    inputs.hyprland.homeManagerModules.default
  ];