Nix/HM: add instructions for upstream module

This commit is contained in:
Mihai Fufezan 2023-07-21 17:21:14 +03:00
parent 9c3e598522
commit b6fecd8876
No known key found for this signature in database

View file

@ -1,7 +1,5 @@
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 - *(Required) NixOS Module*: enables critical components needed to run Hyprland properly
@ -10,14 +8,25 @@ For a list of available options, check the
## 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" >}}
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
@ -51,6 +60,12 @@ 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)" >}}
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
@ -82,11 +97,40 @@ in {
## 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, ...}: { {config, pkgs, ...}: {
# hyprland module from HM
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)
);
};
# hyprland module from the flake
wayland.windowManager.hyprland.extraConfig = '' wayland.windowManager.hyprland.extraConfig = ''
$mod = SUPER $mod = SUPER