DreamMaoMao/hycov

Unsure how to declare the plugin in my Nix config

Closed this issue · 12 comments

Here are my dotfiles. I'm not sure what I'm doing wrong. I have the inputs and outputs declared in the flake. I'm importing the HM modules there as well. Under /home-manager/modules/hyprland/default.nix, you'll see what I was trying to do. It's commented out for now. Any recommendations?

Configuration examples are available in the readme

@BRBWaffles Well, what you've configured is correct, and should work. After setting the configuration, reboot and check if the settings are updated.
You can check out my Hyprland configuration here, if you want further clarification

@maydayv7 Yeah, I'm following the docs to the letter, but it refuses to build. Not sure what the issue is. Your hyprland config didn't really illuminate anything for me, I'm sad to say. I'm still quite new to Nix. I've only been messing with it for a few weeks.

What are the errors you get while building the configuration

@maydayv7

∴ just gobrrr
sudo nixos-rebuild switch --flake /home/nick/dotfiles#desktop
[sudo] password for nick:
building the system configuration...
error:
       … while calling the 'head' builtin

         at /nix/store/3qsyy1d9wlxy0zaa5l27nwis7cjf93qs-source/lib/attrsets.nix:960:11:

          959|         || pred here (elemAt values 1) (head values) then
          960|           head values
             |           ^
          961|         elsewhile evaluating the attribute 'value'

         at /nix/store/3qsyy1d9wlxy0zaa5l27nwis7cjf93qs-source/lib/modules.nix:809:9:

          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          810|         inherit (res.defsFinal') highestPrio;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: attribute 'hycov' missing

       at /nix/store/3qsyy1d9wlxy0zaa5l27nwis7cjf93qs-source/lib/modules.nix:508:28:

          507|         builtins.addErrorContext (context name)
          508|           (args.${name} or config._module.args.${name})
             |                            ^
          509|       ) (lib.functionArgs f);
error: Recipe `gobrrr` failed on line 9 with exit code 1
~ took 4s
¬◇

Umm I think in your home-manager.extraSpecialArgs you have inherited inputs so to access hycov you must do it like so:

dotfiles/home-manager/modules/hyprland/default.nix

{
  pkgs,
  inputs,
  ...
}: {
  wayland.windowManager.hyprland = {
    enable = true;
    xwayland.enable = true;
    systemd.enable = false;
    settings = {
      animation = import ./config/animation.nix;
      bind = import ./config/bind.nix;
      bindm = import ./config/bindm.nix;
      binds = import ./config/binds.nix;
      decoration = import ./config/decoration.nix;
      exec-once = import ./config/exec-once.nix;
      general = import ./config/general.nix;
      input = import ./config/input.nix;
      misc = import ./config/misc.nix;
      windowrule = import ./config/windowrule.nix;
      windowrulev2 = import ./config/windowrulev2.nix;
    };
    plugins = [
      inputs.hycov.packages.${pkgs.system}.hycov
    ];
    extraConfig = ''
      bind=ALT,tab,hycov:toggleoverview

      plugin {
          hycov {
            overview_gappo = 60 #gaps width from screen
            overview_gappi = 24 #gaps width from clients
      	    hotarea_size = 10 #hotarea size in bottom left,10x10
      	    enable_hotarea = 1 # enable mouse cursor hotarea
          }
        }
    '';
  };
  xdg.configFile."wpaperd/wallpaper.toml".source = pkgs.lib.mkForce ./wpaperd/wallpaper.toml;
}

@maydayv7 Man am I embarrassed about that oversight now, haha. Thank you very much! The build went through. However, I cannot get it working. I logged out and logged back in, rebooted, updated the flake, rebuilt, and I cannot get any of the features actually working. The hot area does nothing. The hotkeys do nothing.

In your configuration, wayland.windowManager.hyprland.package must point to the Hyprland version that you compile hycov with i.e. in your case, it would be inputs.hyprland.packages.${pkgs.system}.hyprland

@maydayv7 I just made a commit, and I think I implemented what you're suggesting. But it's still not working, even after a reboot. I must still be doing something wrong.

Do the same for the system configuration i.e. programs.hyprland.package and reboot to see if it helps

@maydayv7 Thanks a million, dude! That was the ticket! Thankfully, there was nothing wrong with the plugin, and only errors in my understanding of Nix, haha. This was actually quite educational for me. Thank you very much for your patience!

You're welcome! Took me some fiddling around too the first time I set it up