mirror of
https://github.com/hyprwm/hyprland-wiki.git
synced 2024-11-24 21:45:59 +01:00
Nix/HM: update instructions for current-state module
This commit is contained in:
parent
b6fecd8876
commit
cf211f571d
1 changed files with 62 additions and 79 deletions
|
@ -2,8 +2,10 @@ For a list of available options, check the
|
||||||
[Home Manager options](https://nix-community.github.io/home-manager/options.html#opt-wayland.windowManager.hyprland.enable).
|
[Home Manager options](https://nix-community.github.io/home-manager/options.html#opt-wayland.windowManager.hyprland.enable).
|
||||||
|
|
||||||
{{< hint title=Note >}}
|
{{< hint title=Note >}}
|
||||||
- *(Required) NixOS Module*: enables critical components needed to run Hyprland properly
|
|
||||||
- *(Optional) Home-manager module*: lets you declaratively configure Hyprland
|
- _(Required) NixOS Module_: enables critical components needed to run Hyprland
|
||||||
|
properly
|
||||||
|
- _(Optional) Home-manager module_: lets you declaratively configure Hyprland
|
||||||
{{< /hint >}}
|
{{< /hint >}}
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
@ -12,7 +14,8 @@ For a list of available options, check the
|
||||||
|
|
||||||
{{< tab "Home Manager" >}}
|
{{< tab "Home Manager" >}}
|
||||||
|
|
||||||
Home Manager has options for Hyprland without needing to import the Flake module.
|
Home Manager has options for Hyprland without needing to import the Flake
|
||||||
|
module.
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
|
@ -21,8 +24,17 @@ Home Manager has options for Hyprland without needing to import the Flake module
|
||||||
```
|
```
|
||||||
|
|
||||||
{{< /tab >}}
|
{{< /tab >}}
|
||||||
|
|
||||||
{{< tab "Flakes" >}}
|
{{< tab "Flakes" >}}
|
||||||
|
|
||||||
|
{{< hint >}}
|
||||||
|
|
||||||
|
The flake module is merely an extension to the Home Manager downstream module.
|
||||||
|
It is mainly used as a staging area for new options, so unless you're a tester
|
||||||
|
you should use the downstream Home Manager module.
|
||||||
|
|
||||||
|
{{< /hint >}}
|
||||||
|
|
||||||
The following snippet of code tries to show how to bring the Hyprland flake from
|
The following snippet of code tries to show how to bring the Hyprland flake from
|
||||||
the flake input and import it into the module system. Feel free to make any
|
the flake input and import it into the module system. Feel free to make any
|
||||||
adjustment for your setup.
|
adjustment for your setup.
|
||||||
|
@ -57,15 +69,23 @@ Don't forget to replace `user@hostname` with your username and hostname!
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
{{< /tab >}}
|
{{< /tab >}}
|
||||||
|
|
||||||
{{< tab "No flakes (with flake-compat)" >}}
|
{{< tab "No flakes (with flake-compat)" >}}
|
||||||
|
|
||||||
|
{{< hint >}}
|
||||||
|
|
||||||
|
The flake module is merely an extension to the Home Manager downstream module.
|
||||||
|
It is mainly used as a staging area for new options, so unless you're a tester
|
||||||
|
you should use the downstream Home Manager module.
|
||||||
|
|
||||||
|
{{< /hint >}}
|
||||||
|
|
||||||
The following snippet of code tries to show how to bring the Hyprland flake from
|
The following snippet of code tries to show how to bring the Hyprland flake from
|
||||||
the flake input and import it into the module system. Feel free to make any
|
the flake input and import it into the module system. Feel free to make any
|
||||||
adjustment for your setup.
|
adjustment for your setup.
|
||||||
|
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
# home config
|
# home config
|
||||||
|
|
||||||
|
@ -76,35 +96,27 @@ adjustment for your setup.
|
||||||
src = builtins.fetchTarball "https://github.com/hyprwm/Hyprland/archive/master.tar.gz";
|
src = builtins.fetchTarball "https://github.com/hyprwm/Hyprland/archive/master.tar.gz";
|
||||||
}).defaultNix;
|
}).defaultNix;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [hyprland.homeManagerModules.default];
|
||||||
hyprland.homeManagerModules.default
|
|
||||||
];
|
|
||||||
|
|
||||||
wayland.windowManager.hyprland = {
|
wayland.windowManager.hyprland.enable = true;
|
||||||
enable = true;
|
|
||||||
|
|
||||||
extraConfig = ''
|
|
||||||
bind = SUPER, Return, exec, kitty
|
|
||||||
# ...
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
{{< /tab >}}
|
{{< /tab >}}
|
||||||
|
|
||||||
{{< /tabs >}}
|
{{< /tabs >}}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Once the module is enabled, you can use it to declaratively configure Hyprland.
|
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
|
Here is an example config, made to work with either the upstream Home Manager
|
||||||
module, or the Flake-based Home Manager module.
|
module, or the flake-based Home Manager module.
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
# home.nix
|
# home.nix
|
||||||
{config, pkgs, ...}: {
|
{
|
||||||
# hyprland module from HM
|
|
||||||
wayland.windowManager.hyprland.settings = {
|
wayland.windowManager.hyprland.settings = {
|
||||||
"$mod" = "SUPER";
|
"$mod" = "SUPER";
|
||||||
bind =
|
bind =
|
||||||
|
@ -129,37 +141,12 @@ module, or the Flake-based Home Manager module.
|
||||||
10)
|
10)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
# hyprland module from the flake
|
|
||||||
wayland.windowManager.hyprland.extraConfig = ''
|
|
||||||
$mod = SUPER
|
|
||||||
|
|
||||||
bind = $mod, F, exec, firefox
|
|
||||||
bind = , Print, exec, grimblast copy area
|
|
||||||
|
|
||||||
# workspaces
|
|
||||||
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
|
|
||||||
${builtins.concatStringsSep "\n" (builtins.genList (
|
|
||||||
x: let
|
|
||||||
ws = let
|
|
||||||
c = (x + 1) / 10;
|
|
||||||
in
|
|
||||||
builtins.toString (x + 1 - (c * 10));
|
|
||||||
in ''
|
|
||||||
bind = $mod, ${ws}, workspace, ${toString (x + 1)}
|
|
||||||
bind = $mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}
|
|
||||||
''
|
|
||||||
)
|
|
||||||
10)}
|
|
||||||
|
|
||||||
# ...
|
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Plugins
|
## Plugins
|
||||||
|
|
||||||
Hyprland plugins can be added through an option:
|
Hyprland plugins can be added through the `plugins` option:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
wayland.windowManager.hyprland.plugins = [
|
wayland.windowManager.hyprland.plugins = [
|
||||||
|
@ -168,45 +155,41 @@ wayland.windowManager.hyprland.plugins = [
|
||||||
];
|
];
|
||||||
```
|
```
|
||||||
|
|
||||||
For examples on how to build hyprland plugins using nix see the
|
For examples on how to build Hyprland plugins using nix see the
|
||||||
[official plugins](https://github.com/hyprwm/hyprland-plugins).
|
[official plugins](https://github.com/hyprwm/hyprland-plugins).
|
||||||
|
|
||||||
## Fixing problems with themes
|
## 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.
|
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:
|
Example configuration:
|
||||||
```
|
|
||||||
home-manager = {
|
```nix
|
||||||
useGlobalPkgs = true;
|
home.pointerCursor = {
|
||||||
useUserPackages = true;
|
|
||||||
users.username = {
|
|
||||||
home = {
|
|
||||||
stateVersion = "23.05";
|
|
||||||
pointerCursor = {
|
|
||||||
gtk.enable = true;
|
gtk.enable = true;
|
||||||
# x11.enable = true;
|
# x11.enable = true;
|
||||||
package = pkgs.bibata-cursors;
|
package = pkgs.bibata-cursors;
|
||||||
name = "Bibata-Modern-Amber";
|
name = "Bibata-Modern-Classic";
|
||||||
size = 32;
|
size = 16;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
gtk = {
|
gtk = {
|
||||||
enable = true;
|
enable = true;
|
||||||
theme = {
|
theme = {
|
||||||
package = pkgs.flat-remix-gtk;
|
package = pkgs.flat-remix-gtk;
|
||||||
name = "Flat-Remix-GTK-Grey-Darkest";
|
name = "Flat-Remix-GTK-Grey-Darkest";
|
||||||
};
|
};
|
||||||
|
|
||||||
iconTheme = {
|
iconTheme = {
|
||||||
package = pkgs.libsForQt5.breeze-icons;
|
package = pkgs.gnome.adwaita-icon-theme;
|
||||||
name = "breeze-dark";
|
name = "Adwaita";
|
||||||
};
|
};
|
||||||
|
|
||||||
font = {
|
font = {
|
||||||
name = "Sans";
|
name = "Sans";
|
||||||
size = 11;
|
size = 11;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue