mirror of
https://github.com/hyprwm/hyprland-wiki.git
synced 2024-11-22 12:45:59 +01:00
Nix/HM: update instructions (#273)
This commit is contained in:
parent
9c3e598522
commit
eaf04412d6
2 changed files with 121 additions and 86 deletions
|
@ -1,23 +1,44 @@
|
||||||
You can use the Home Manager module by adding it to your configuration:
|
|
||||||
|
|
||||||
For a list of available options, check the
|
For a list of available options, check the
|
||||||
[module file](https://github.com/hyprwm/Hyprland/blob/main/nix/hm-module.nix).
|
[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
|
||||||
{{< /hint >}}
|
properly
|
||||||
|
- _(Optional) Home-manager module_: lets you declaratively configure Hyprland
|
||||||
|
{{< /hint >}}
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
The following snippets of code try to show how to bring the Hyprland flake from
|
|
||||||
the flake input and import it into the module system. Feel free to make any
|
|
||||||
adjustment for your setup.
|
|
||||||
|
|
||||||
{{< tabs "uniqueid" >}}
|
{{< tabs "uniqueid" >}}
|
||||||
|
|
||||||
|
{{< tab "Home Manager" >}}
|
||||||
|
|
||||||
|
Home Manager has options for Hyprland without needing to import the Flake
|
||||||
|
module.
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
wayland.windowManager.hyprland.enable = true;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
{{< /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 flake input and import it into the module system. Feel free to make any
|
||||||
|
adjustment for your setup.
|
||||||
|
|
||||||
Don't forget to replace `user@hostname` with your username and hostname!
|
Don't forget to replace `user@hostname` with your username and hostname!
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
|
@ -48,9 +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 flake input and import it into the module system. Feel free to make any
|
||||||
|
adjustment for your setup.
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
# home config
|
# home config
|
||||||
|
|
||||||
|
@ -61,61 +96,57 @@ Don't forget to replace `user@hostname` with your username and hostname!
|
||||||
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
|
||||||
|
module, or the flake-based Home Manager module.
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
# home.nix
|
# home.nix
|
||||||
{config, pkgs, ...}: {
|
{
|
||||||
wayland.windowManager.hyprland.extraConfig = ''
|
wayland.windowManager.hyprland.settings = {
|
||||||
$mod = SUPER
|
"$mod" = "SUPER";
|
||||||
|
bind =
|
||||||
bind = $mod, F, exec, firefox
|
[
|
||||||
bind = , Print, exec, grimblast copy area
|
"$mod, F, exec, firefox"
|
||||||
|
", Print, exec, grimblast copy area"
|
||||||
# workspaces
|
]
|
||||||
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
|
++ (
|
||||||
${builtins.concatStringsSep "\n" (builtins.genList (
|
# workspaces
|
||||||
x: let
|
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
|
||||||
ws = let
|
builtins.concatLists (builtins.genList (
|
||||||
c = (x + 1) / 10;
|
x: let
|
||||||
in
|
ws = let
|
||||||
builtins.toString (x + 1 - (c * 10));
|
c = (x + 1) / 10;
|
||||||
in ''
|
in
|
||||||
bind = $mod, ${ws}, workspace, ${toString (x + 1)}
|
builtins.toString (x + 1 - (c * 10));
|
||||||
bind = $mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}
|
in [
|
||||||
''
|
"$mod, ${ws}, workspace, ${toString (x + 1)}"
|
||||||
)
|
"$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
|
||||||
10)}
|
]
|
||||||
|
)
|
||||||
# ...
|
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 = [
|
||||||
|
@ -124,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;
|
gtk.enable = true;
|
||||||
users.username = {
|
# x11.enable = true;
|
||||||
home = {
|
package = pkgs.bibata-cursors;
|
||||||
stateVersion = "23.05";
|
name = "Bibata-Modern-Classic";
|
||||||
pointerCursor = {
|
size = 16;
|
||||||
gtk.enable = true;
|
};
|
||||||
# x11.enable = true;
|
|
||||||
package = pkgs.bibata-cursors;
|
gtk = {
|
||||||
name = "Bibata-Modern-Amber";
|
enable = true;
|
||||||
size = 32;
|
theme = {
|
||||||
};
|
package = pkgs.flat-remix-gtk;
|
||||||
};
|
name = "Flat-Remix-GTK-Grey-Darkest";
|
||||||
gtk = {
|
|
||||||
enable = true;
|
|
||||||
theme = {
|
|
||||||
package = pkgs.flat-remix-gtk;
|
|
||||||
name = "Flat-Remix-GTK-Grey-Darkest";
|
|
||||||
};
|
|
||||||
iconTheme = {
|
|
||||||
package = pkgs.libsForQt5.breeze-icons;
|
|
||||||
name = "breeze-dark";
|
|
||||||
};
|
|
||||||
font = {
|
|
||||||
name = "Sans";
|
|
||||||
size = 11;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
iconTheme = {
|
||||||
|
package = pkgs.gnome.adwaita-icon-theme;
|
||||||
|
name = "Adwaita";
|
||||||
|
};
|
||||||
|
|
||||||
|
font = {
|
||||||
|
name = "Sans";
|
||||||
|
size = 11;
|
||||||
|
};
|
||||||
|
};
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
To install Hyprland on NixOS, we provide a NixOS and a Home Manager module.
|
To install Hyprland on NixOS, we provide a NixOS and a Home Manager module.
|
||||||
|
|
||||||
{{< 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
|
||||||
{{< /hint >}}
|
properly
|
||||||
|
- _(Optional) Home-manager module_: lets you declaratively configure Hyprland
|
||||||
|
{{< /hint >}}
|
||||||
|
|
||||||
## NixOS module
|
## NixOS module
|
||||||
|
|
||||||
The module is now upstreamed into Nixpkgs, which means all you need in your configuration is:
|
The module is now upstreamed into Nixpkgs, which means all you need in your
|
||||||
|
configuration is:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{config, pkgs, ...}: {
|
{config, pkgs, ...}: {
|
||||||
|
@ -17,7 +20,8 @@ The module is now upstreamed into Nixpkgs, which means all you need in your conf
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that the command to run hyprland is `Hyprland` (with a capital `H`) and not `hyprland`.
|
Note that the command to run hyprland is `Hyprland` (with a capital `H`) and not
|
||||||
|
`hyprland`.
|
||||||
|
|
||||||
For more options, see
|
For more options, see
|
||||||
[module options](https://search.nixos.org/options?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=hyprland).
|
[module options](https://search.nixos.org/options?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=hyprland).
|
||||||
|
@ -28,6 +32,10 @@ For other NixOS options, see [Hyprland on NixOS](./Hyprland-on-NixOS).
|
||||||
|
|
||||||
Read [Hyprland on Home Manager](./Hyprland-on-Home-Manager).
|
Read [Hyprland on Home Manager](./Hyprland-on-Home-Manager).
|
||||||
|
|
||||||
|
For the adventurous, [@spikespaz](https://github.com/spikespaz) has made a
|
||||||
|
Hyprland module that can be used in Home Manager and NixOS. It can be found
|
||||||
|
[here](https://github.com/spikespaz/hyprland-nix).
|
||||||
|
|
||||||
## Options and overrides
|
## Options and overrides
|
||||||
|
|
||||||
Read [Options & Overrides](./Options-Overrides).
|
Read [Options & Overrides](./Options-Overrides).
|
||||||
|
|
Loading…
Reference in a new issue