Nix: add Nixpkgs module instructions

This commit is contained in:
Mihai Fufezan 2023-04-09 15:02:54 +03:00
parent d62432ed53
commit 569aeec905
No known key found for this signature in database
GPG key ID: 5899325F2F120900
4 changed files with 57 additions and 20 deletions

View file

@ -5,12 +5,46 @@ graphics drivers, fonts, dconf, xwayland, and adding a proper Desktop Entry to
your Display Manager.
Make sure to check out the options of the
[NixOS module](https://github.com/hyprwm/Hyprland/blob/main/nix/module.nix).
[NixOS module](https://search.nixos.org/options?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=hyprland).
Note that the Nixpkgs Hyprland package is not actively maintained, and may be outdated.
As such, installation using the Flake is recommended.
## From Nixpkgs
## With flakes
```nix
# configuration.nix
{pkgs, ...}: {
programs.hyprland.enable = true;
}
```
### Using unstable Hyprland
In case you want to use the module from Nixpkgs, but also want the development
version of Hyprland, you can add it like this:
```nix
# flake.nix
{
inputs.hyprland.url = "github:hyprwm/Hyprland";
# ...
outputs = {nixpkgs, ...} @ inputs: {
nixosConfigurations.HOSTNAME = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs;}; # this is the important part
modules = [./configuration.nix];
};
}
}
# configuration.nix
{inputs, pkgs, ...}: {
programs.hyprland.package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
}
```
## From the Flake
```nix
# flake.nix
@ -22,7 +56,6 @@ As such, installation using the Flake is recommended.
outputs = {nixpkgs, hyprland, ...}: {
nixosConfigurations.HOSTNAME = nixpkgs.lib.nixosSystem {
# ...
modules = [
hyprland.nixosModules.default
{programs.hyprland.enable = true;}
@ -35,7 +68,7 @@ As such, installation using the Flake is recommended.
Don't forget to replace `HOSTNAME` with your hostname!
## Without flakes
## From the Flake, on Nix stable
{{< hint >}}
If you're using Hyprland through an overlay, set
@ -63,7 +96,7 @@ in {
xwayland = {
enable = true;
hidpi = true;
hidpi = false;
};
nvidiaPatches = false;

View file

@ -4,7 +4,15 @@ 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.
## With flakes
## From Nixpgks
The easiest method is to get Hyprland directly from Nixpkgs:
```sh
nix profile install nixpkgs#hyprland
```
## From the Flake
First, [enable flakes](https://nixos.wiki/wiki/Flakes#Enable_flakes).

View file

@ -9,7 +9,7 @@ can be changed by setting the appropriate option to `true`/`false`.
### Package
```nix
(inputs.hyprland.packages.${pkgs.hostPlatform.system}.default.override {
(pkgs.hyprland.override { # or inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.default
enableXWayland = true;
hidpiXWayland = true;
nvidiaPatches = false;

View file

@ -1,18 +1,14 @@
First of all, it is a good idea to set up [Cachix](./Cachix) before continuing
with installing Hyprland.
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).
After getting Cachix working, you have a few options ahead:
If you use the flake, it is a good idea to set up [Cachix](./Cachix) before
continuing with installing Hyprland.
The methods of installation are described below:
## NixOS + Home Manager (recommended)
{{< hint type=warning >}}
Hyprland is NOT supported on NixOS stable. It may (not) compile or
work as intended. Please use the
[flake](https://github.com/hyprwm/Hyprland/blob/main/flake.nix).
{{< /hint >}}
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.