mirror of
https://github.com/hyprwm/hyprland-wiki.git
synced 2024-11-22 12:45:59 +01:00
Nix: simplify pages (#187)
* clear-up nixos installation * Nix: clear up wording * Nix: add example config for HM Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
This commit is contained in:
parent
3d83cc67ce
commit
9a9d89b96a
8 changed files with 155 additions and 129 deletions
|
@ -38,8 +38,19 @@ hyprland - binary x86 tagged release
|
|||
```
|
||||
|
||||
{{< /tab >}}
|
||||
{{< tab "Nix" >}}Read the [Nix page](../../Nix).{{< /tab >}}
|
||||
{{< tab "Nix" >}}
|
||||
|
||||
Enable Hyprland in your NixOS configuration:
|
||||
|
||||
```nix
|
||||
programs.hyprland.enable = true;
|
||||
```
|
||||
|
||||
For more details, read the [Nix page](../../Nix).
|
||||
|
||||
{{< /tab >}}
|
||||
{{< tab "openSUSE*" >}}
|
||||
>>>>>>> b147dc5 (clear-up nixos installation)
|
||||
Hyprland is part of factory, starting with snapshot 20230411. To install it simply use zypper
|
||||
|
||||
```sh
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
NOTE: This page only applies to the flake package. You can safely skip this if you use
|
||||
the Nixpkgs package.
|
||||
NOTE: This page only applies to the flake package. You can safely skip this if
|
||||
you use the Nixpkgs package.
|
||||
|
||||
Hyprland is not built by Hydra and cached in `cache.nixos.org`, like the rest
|
||||
of the Nixpkgs packages.
|
||||
|
@ -13,13 +13,7 @@ The [Hyprland Cachix](https://app.cachix.org/cache/hyprland) exists to cache the
|
|||
|
||||
{{< hint >}}
|
||||
In order for Nix to take advantage of the cache, it has to be enabled **before**
|
||||
enabling the Hyprland module(s) or adding the package.
|
||||
{{< /hint >}}
|
||||
|
||||
{{< hint type=important >}}
|
||||
Overriding Hyprland's `nixpkgs` input
|
||||
(`inputs.hyprland.inputs.nixpkgs.follows = "nixpkgs";`) will make the cache
|
||||
useless, since you're building from a different Nixpkgs commit.
|
||||
enabling the Hyprland flake package.
|
||||
{{< /hint >}}
|
||||
|
||||
```nix
|
||||
|
@ -31,3 +25,12 @@ useless, since you're building from a different Nixpkgs commit.
|
|||
};
|
||||
}
|
||||
```
|
||||
|
||||
{{< hint type=important >}}
|
||||
Do **not** override Hyprland's `nixpkgs` input unless you know what you are
|
||||
doing.
|
||||
|
||||
Doing so will make the cache useless, since you're building from a different
|
||||
Nixpkgs commit.
|
||||
{{< /hint >}}
|
||||
|
||||
|
|
|
@ -3,7 +3,18 @@ You can use the Home Manager module by adding it to your configuration:
|
|||
For a list of available options, check the
|
||||
[module file](https://github.com/hyprwm/Hyprland/blob/main/nix/hm-module.nix).
|
||||
|
||||
## With flakes
|
||||
|
||||
## 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" >}}
|
||||
|
||||
{{< tab "Flakes" >}}
|
||||
|
||||
Don't forget to replace `user@hostname` with your username and hostname!
|
||||
|
||||
```nix
|
||||
# flake.nix
|
||||
|
@ -33,11 +44,9 @@ For a list of available options, check the
|
|||
};
|
||||
}
|
||||
```
|
||||
{{< /tab >}}
|
||||
|
||||
Don't forget to replace `user@hostname` with your username and hostname!
|
||||
|
||||
## Without flakes
|
||||
|
||||
{{< tab "No flakes (with flake-compat)" >}}
|
||||
```nix
|
||||
# home config
|
||||
|
||||
|
@ -62,3 +71,54 @@ in {
|
|||
};
|
||||
}
|
||||
```
|
||||
{{< /tab >}}
|
||||
|
||||
{{< /tabs >}}
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Once the module is enabled, you can use it to declaratively configure Hyprland:
|
||||
|
||||
```nix
|
||||
# home.nix
|
||||
{config, pkgs, ...}: {
|
||||
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
|
||||
|
||||
Hyprland plugins can be added through an option:
|
||||
|
||||
```nix
|
||||
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](https://github.com/hyprwm/hyprland-plugins).
|
||||
|
|
|
@ -7,7 +7,9 @@ your Display Manager.
|
|||
Make sure to check out the options of the
|
||||
[NixOS module](https://search.nixos.org/options?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=hyprland).
|
||||
|
||||
## From Nixpkgs
|
||||
{{< tabs "uniqueid" >}}
|
||||
|
||||
{{< tab "Nixpkgs" >}}
|
||||
|
||||
```nix
|
||||
# configuration.nix
|
||||
|
@ -17,10 +19,19 @@ Make sure to check out the options of the
|
|||
}
|
||||
```
|
||||
|
||||
### Using unstable Hyprland
|
||||
This will use the Hyprland version that Nixpkgs has.
|
||||
|
||||
In case you want to use the module from Nixpkgs, but also want the development
|
||||
version of Hyprland, you can add it like this:
|
||||
{{< /tab >}}
|
||||
|
||||
{{< tab "Flake package" >}}
|
||||
|
||||
{{< hint >}}
|
||||
Please enable [Cachix](../Cachix) before using the flake package, so you don't
|
||||
have to compile Hyprland yourself.
|
||||
{{< /hint >}}
|
||||
|
||||
In case you want to use the development version of Hyprland, you can add it
|
||||
like this:
|
||||
|
||||
```nix
|
||||
# flake.nix
|
||||
|
@ -31,8 +42,10 @@ version of Hyprland, you can add it like this:
|
|||
|
||||
outputs = {nixpkgs, ...} @ inputs: {
|
||||
nixosConfigurations.HOSTNAME = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {inherit inputs;}; # this is the important part
|
||||
modules = [./configuration.nix];
|
||||
specialArgs = { inherit inputs; }; # this is the important part
|
||||
modules = [
|
||||
./configuration.nix
|
||||
];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -40,40 +53,21 @@ version of Hyprland, you can add it like this:
|
|||
# configuration.nix
|
||||
|
||||
{inputs, pkgs, ...}: {
|
||||
programs.hyprland.package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
|
||||
}
|
||||
```
|
||||
|
||||
## From the Flake
|
||||
|
||||
```nix
|
||||
# flake.nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
hyprland.url = "github:hyprwm/Hyprland";
|
||||
};
|
||||
|
||||
outputs = {nixpkgs, hyprland, ...}: {
|
||||
nixosConfigurations.HOSTNAME = nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
hyprland.nixosModules.default
|
||||
{programs.hyprland.enable = true;}
|
||||
# ...
|
||||
];
|
||||
};
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
package = inputs.hyprland.packages.${pkgs.system}.hyprland;
|
||||
};
|
||||
}
|
||||
```
|
||||
Don't forget to change the `HOSTNAME` to your actual hostname!
|
||||
|
||||
Don't forget to replace `HOSTNAME` with your hostname!
|
||||
{{< /tab >}}
|
||||
|
||||
## From the Flake, on Nix stable
|
||||
{{< tab "Flake package, Nix stable" >}}
|
||||
|
||||
{{< hint >}}
|
||||
If you're using Hyprland through an overlay, set
|
||||
`programs.hyprland.package = pkgs.hyprland;`. This also means the `xwayland`
|
||||
and `nvidiaPatches` options no longer apply.
|
||||
Please enable [Cachix](../Cachix) before using the flake package, so you don't
|
||||
have to compile Hyprland yourself.
|
||||
{{< /hint >}}
|
||||
|
||||
```nix
|
||||
|
@ -82,24 +76,16 @@ and `nvidiaPatches` options no longer apply.
|
|||
{pkgs, ...}: let
|
||||
flake-compat = builtins.fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz";
|
||||
|
||||
hyprland = (import flake-compat {
|
||||
hyprland-flake = (import flake-compat {
|
||||
src = builtins.fetchTarball "https://github.com/hyprwm/Hyprland/archive/master.tar.gz";
|
||||
}).defaultNix;
|
||||
in {
|
||||
imports = [hyprland.nixosModules.default];
|
||||
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
|
||||
# default options, you don't need to set them
|
||||
package = hyprland.packages.${pkgs.system}.default;
|
||||
|
||||
xwayland = {
|
||||
enable = true;
|
||||
hidpi = false;
|
||||
};
|
||||
|
||||
nvidiaPatches = false;
|
||||
package = hyprland-flake.packages.${pkgs.system}.hyprland;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
{{< /tab >}}
|
||||
{{< /tabs >}}
|
||||
|
|
|
@ -4,7 +4,12 @@ The best option would be through [Home Manager](../Hyprland-on-Home-Manager).
|
|||
|
||||
However, if Home Manager is not for you, you can use it as a normal package.
|
||||
|
||||
## From Nixpkgs
|
||||
First, [enable flakes](https://nixos.wiki/wiki/Flakes#Enable_flakes).
|
||||
Once you have flakes working, install Hyprland through `nix profile`:
|
||||
|
||||
{{< tabs "uniqueid" >}}
|
||||
|
||||
{{< tab "From Nixpkgs" >}}
|
||||
|
||||
The easiest method is to get Hyprland directly from Nixpkgs:
|
||||
|
||||
|
@ -12,16 +17,18 @@ The easiest method is to get Hyprland directly from Nixpkgs:
|
|||
nix profile install nixpkgs#hyprland
|
||||
```
|
||||
|
||||
## From the Flake
|
||||
{{< /tab >}}
|
||||
{{< tab "From the Flake" >}}
|
||||
|
||||
First, [enable flakes](https://nixos.wiki/wiki/Flakes#Enable_flakes).
|
||||
|
||||
Once you have flakes working, install Hyprland through `nix profile`:
|
||||
NOTE: Make sure to enable [Cachix](../Cachix) first.
|
||||
|
||||
```sh
|
||||
nix profile install github:hyprwm/Hyprland
|
||||
```
|
||||
|
||||
{{< /tab >}}
|
||||
{{< /tabs >}}
|
||||
|
||||
Since you're using Hyprland outside of NixOS, it won't be able to find graphics
|
||||
drivers. To get around that, you can use [nixGL](https://github.com/guibou/nixGL).
|
||||
|
||||
|
@ -52,3 +59,4 @@ nix profile upgrade '.*'
|
|||
Check the
|
||||
[nix profile](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-profile.html)
|
||||
command documentation for other upgrade options.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
You can override the package through `.override` or `.overrideAttrs`. This is
|
||||
easily achievable through NixOS or Home Manager.
|
||||
easily achievable through [NixOS](../Hyprland-on-NixOS) or [Home Manager](../Hyprland-on-Home-Manager).
|
||||
|
||||
## Package options
|
||||
|
||||
|
@ -9,7 +9,7 @@ can be changed by setting the appropriate option to `true`/`false`.
|
|||
### Package
|
||||
|
||||
```nix
|
||||
(pkgs.hyprland.override { # or inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.default
|
||||
(pkgs.hyprland.override { # or inputs.hyprland.packages.${pkgs.system}.hyprland
|
||||
enableXWayland = true;
|
||||
hidpiXWayland = false;
|
||||
nvidiaPatches = false;
|
||||
|
@ -62,23 +62,9 @@ env = XCURSOR_SIZE,48
|
|||
```
|
||||
|
||||
{{< hint >}}
|
||||
The GDK_SCALE variable won't conflict with wayland-native GTK programs.
|
||||
The `GDK_SCALE` environment variable won't conflict with Wayland-native GTK programs.
|
||||
{{< /hint >}}
|
||||
|
||||
### Plugins
|
||||
|
||||
Hyprland plugins can be added through the home manager module.
|
||||
|
||||
```nix
|
||||
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](https://github.com/hyprwm/hyprland-plugins).
|
||||
|
||||
### Nvidia Patches
|
||||
|
||||
Nvidia is notorious for not working by default with wlroots. That's why we
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
`xdg-desktop-portal-hyprland` (xdph) is a fork of `xdg-desktop-portal-wlr`
|
||||
(xdpw), which supports window sharing and region sharing (currently broken),
|
||||
apart from output (per-screen) sharing.
|
||||
|
||||
Due to the internal workings, `xdph` depends on the Hyprland package for
|
||||
getting the window list. However, we cannot make a cross-dependency betwen
|
||||
the Hyprland flake and the `xdph` flake.
|
||||
|
||||
The best solution we found to make everything work properly was to override
|
||||
the Hyprland package that `xdph` builds with.
|
||||
|
||||
In the Hyprland flake, it's done like this:
|
||||
```nix
|
||||
xdg-desktop-portal-hyprland = inputs.xdph.packages.${prev.system}.default.override {
|
||||
hyprland-share-picker = inputs.xdph.packages.${prev.system}.hyprland-share-picker.override {inherit hyprland;};
|
||||
};
|
||||
```
|
||||
|
||||
{{< hint >}}
|
||||
A similar override is done inside the [NixOS module](../Hyprland-on-NixOS), so
|
||||
you do not have to tinker with it if you use the module.
|
||||
{{< /hint >}}
|
||||
|
||||
If you don't use the module, you will want to do a similar override in your
|
||||
configuration.
|
|
@ -1,30 +1,27 @@
|
|||
Hyprland on Nix can be installed either from Nixpkgs (release version) or from
|
||||
the [flake](https://github.com/hyprwm/Hyprland/blob/main/flake.nix) (directly
|
||||
from the main branch).
|
||||
To install Hyprland on NixOS, we provide a NixOS and a Home Manager module.
|
||||
|
||||
If you use the flake, it is a good idea to set up [Cachix](./Cachix) before
|
||||
continuing with installing Hyprland.
|
||||
{{< hint title=note >}}
|
||||
- *(Required) NixOS Module*: enables critical components needed to run Hyprland properly
|
||||
- *(Optional) Home-manager module*: lets you declaratively configure Hyprland
|
||||
{{< /hint >}}
|
||||
|
||||
The methods of installation are described below:
|
||||
## NixOS module
|
||||
|
||||
## NixOS + Home Manager (recommended)
|
||||
The module is now upstreamed into Nixpkgs, which means all you need in your configuration is:
|
||||
|
||||
If you're on NixOS and also use HM, it is a good idea to use Hyprland modules
|
||||
for both. Make sure the package options are the same for both modules.
|
||||
```nix
|
||||
{config, pkgs, ...}: {
|
||||
programs.hyprland.enable = true;
|
||||
# Optional, hint electron apps to use wayland:
|
||||
# environment.sessionVariables.NIXOS_OZONE_WL = "1";
|
||||
}
|
||||
```
|
||||
|
||||
Read [Hyprland on NixOS](./Hyprland-on-NixOS) and
|
||||
[Hyprland on Home Manager](./Hyprland-on-Home-Manager).
|
||||
For more options, see
|
||||
[module options](https://search.nixos.org/options?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=hyprland).
|
||||
|
||||
## Home Manager only
|
||||
For other NixOS options, see [Hyprland on NixOS](./Hyprland-on-NixOS).
|
||||
|
||||
If you do not plan on using the NixOS module, but want to use the HM module, you
|
||||
will have to enable all the options the NixOS module enables.
|
||||
## Home-manager module
|
||||
|
||||
Read [Hyprland on Home Manager](./Hyprland-on-Home-Manager).
|
||||
|
||||
## On your own
|
||||
|
||||
If you don't plan on using any module, manually enable all the options that the
|
||||
modules have set.
|
||||
|
||||
Read [the sources](https://github.com/hyprwm/Hyprland/tree/main/nix).
|
||||
|
|
Loading…
Reference in a new issue