Nix
Hyprland on Home Manager

Hyprland on Home Manager

For a list of available options, check the Home Manager options.

  • (Required) NixOS Module: enables critical components needed to run Hyprland properly
  • (Optional) Home-manager module: lets you declaratively configure Hyprland

Installation

Usage

Once the module is enabled, you can use it to declaratively configure Hyprland. Here is an example config, made to work with either the upstream Home Manager module, or the flake-based Home Manager module.

# home.nix
{
  wayland.windowManager.hyprland.settings = {
    "$mod" = "SUPER";
    bind =
      [
        "$mod, F, exec, firefox"
        ", Print, exec, grimblast copy area"
      ]
      ++ (
        # workspaces
        # binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
        builtins.concatLists (builtins.genList (
            x: let
              ws = let
                c = (x + 1) / 10;
              in
                builtins.toString (x + 1 - (c * 10));
            in [
              "$mod, ${ws}, workspace, ${toString (x + 1)}"
              "$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
            ]
          )
          10)
      );
  };
}

Plugins

Hyprland plugins can be added through the plugins option:

wayland.windowManager.hyprland.plugins = [
  inputs.hyprland-plugins.packages.${pkgs.system}.hyprbars
  "/absolute/path/to/plugin.so"
];

For examples on how to build Hyprland plugins using nix see the official plugins.

Fixing problems with themes

If your themes for mouse cursor, icons or windows don’t load correctly, try setting them with home.pointerCursor and gtk.theme, which enable a bunch of compatibility options that should make the themes load in all situations.

Example configuration:

home.pointerCursor = {
  gtk.enable = true;
  # x11.enable = true;
  package = pkgs.bibata-cursors;
  name = "Bibata-Modern-Classic";
  size = 16;
};

gtk = {
  enable = true;
  theme = {
    package = pkgs.flat-remix-gtk;
    name = "Flat-Remix-GTK-Grey-Darkest";
  };

  iconTheme = {
    package = pkgs.gnome.adwaita-icon-theme;
    name = "Adwaita";
  };

  font = {
    name = "Sans";
    size = 11;
  };
};