Duckonaut / split-monitor-workspaces

A small Hyprland plugin to provide awesome-like workspace behavior
BSD 3-Clause "New" or "Revised" License
344 stars 47 forks source link

NixOs: Error: Failed to load plugin #30

Open GARcraft opened 1 year ago

GARcraft commented 1 year ago

Hi!

I'm using NixOs and I want to use this plugin in my Hyprland.

After installing my plugin with Home-manager it shows that error: image

Can you help me please?

Here is my flake.nix (string "username" is changed with my actual user name):

{
  description = "A very basic flake";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";   

    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    hyprland.url = "github:hyprwm/Hyprland";
    split-monitor-workspaces = {
      url = "github:Duckonaut/split-monitor-workspaces";
      inputs.hyprland.follows = "hyprland";
    };

  };

  outputs = {
    self,
    nixpkgs,
    hyprland,
    home-manager,
    split-monitor-workspaces,
    ...
  }@inputs: 

  let
    system = "x86_64-linux";
    pkgs = import nixpkgs {
      inherit system split-monitor-workspaces;
      config = {
        allowUnfree = true;
      };
    };

  in
  {
    nixosConfigurations = {
      nixos = nixpkgs.lib.nixosSystem {
        inherit system;
        specialArgs = { inherit inputs system split-monitor-workspaces; };

        modules = [
          ./nixos/configuration.nix

          home-manager.nixosModules.home-manager
          {
            home-manager = {
              extraSpecialArgs = { inherit system hyprland split-monitor-workspaces; };
              useGlobalPkgs = true;
              useUserPackages = true;

              users.username = {
                programs.home-manager.enable = true;
                home.stateVersion = "23.11"; # Please read the comment before changing.
                home.username = "username";
                home.homeDirectory = "/home/username";

                wayland.windowManager.hyprland = {
                  enable = true;

                  plugins = [
                    split-monitor-workspaces.packages.${pkgs.system}.split-monitor-workspaces
                  ];

                  extraConfig = ''
                    plugin {
                      split-monitor-workspaces {
                        count = 5
                      }
                    }
                    # my hyprland config
                  '';
                };
              };

            };
          }
        ];

      };
    };
  };
}
zilti commented 1 year ago

I have the exact same issue and would love to know how to solve this. I suspect it is because in your (and my) config, split-monitor-workspaces builds on the Hyprland pointed at by hyprland.url, while the actual Hyprland we use is the one from home-manager.

OakleyCord commented 1 year ago

add package = inputs.hyprland.packages.${pkgs.system}.hyprland to wayland.windowManager.hyprland like this

wayland.windowManager.hyprland = {
    ...
    package = inputs.hyprland.packages.${pkgs.system}.hyprland;
    ...
}

that fixes it for me and is listed on the hyprland wiki for using flakes :)

Golodir commented 9 months ago

add package = inputs.hyprland.packages.${pkgs.system}.hyprland to wayland.windowManager.hyprland like this

wayland.windowManager.hyprland = {
    ...
    package = inputs.hyprland.packages.${pkgs.system}.hyprland;
    ...
}

that fixes it for me and is listed on the hyprland wiki for using flakes :)

This did not fix it for me. I tried with or without cachix. The plugin does not crash when I start hyprland in a nested window.

Daniel-McLarty commented 7 months ago

This is broken for me too, I tried to use a custom version for a while but it went 404.

nonetrix commented 7 months ago

This is broken for me too, I tried to use a custom version for a while but it went 404.

For now at least, just use Hyprsplit. They are functionality wise the exact same for me https://github.com/shezdy/hyprsplit

hans-chrstn commented 7 months ago

works fine for me. here's what i did (make sure to add your settings option):

{  inputs, pkgs, ... }:
{
  wayland.windowManager.hyprland = {
    enable = true;
    package = inputs.hyprland.packages.${pkgs.system}.hyprland;
    plugins = [
      inputs.split-monitor-workspaces.packages.${pkgs.system}.split-monitor-workspaces
    ];
  };
}

parts of my flake

{

  inputs = {
    nixpkgs = {
      url = "github:nixos/nixpkgs/nixos-unstable";
    };

    home-manager = {
      url = "github:nix-community/home-manager/master";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    hyprland = {
      url = "github:hyprwm/Hyprland";
    };

    split-monitor-workspaces = {
      url = "github:Duckonaut/split-monitor-workspaces";
      inputs.hyprland.follows = "hyprland"; # <- make sure this line is present for the plugin to work as intended
    }; 
  };

  outputs = {
    self,
    nixpkgs,
    home-manager,
    ...
  } @ inputs: let
    inherit (self) outputs;

    nixosConfigurations = {
      default = nixpkgs.lib.nixosSystem {
        specialArgs = {inherit inputs outputs;};
        modules = [
          ./hosts/default/system/configuration.nix
        ];
      };
    };

    homeConfigurations = {
      default = home-manager.lib.homeManagerConfiguration {
        pkgs = nixpkgs.legacyPackages.x86_64-linux;
        extraSpecialArgs = {inherit inputs outputs;};
        modules = [
          ./home/profiles/default/default.nix
        ];
      };
    };
  };
}
devraza commented 1 month ago

I think it's worth mentioning here that I had to restart Hyprland for the fix presented by @OakleyCord to work.

turtton commented 2 weeks ago

I had same issue, but resolved after executing nix flake update in my configurations. Current versions

$ hyprctl version ``` Hyprland 0.44.0 built from branch at commit 0ec128e5ed5e15aaebff6c4b5983326ab524d690 (). Date: 2024-11-06 Tag: , commits: 5422 built against aquamarine 0.4.3 flags set: debug ```
$ hyprctl plugin list ``` Plugin split-monitor-workspaces by Duckonaut: Handle: 3675c870 Version: 1.2.0 Description: Split monitor workspace namespaces ```

It looks can happen if the version of hyprland is older than plugin expected.