From 569aeec9057c6fc1124d78aae752b672781b4095 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Sun, 9 Apr 2023 15:02:54 +0300 Subject: [PATCH] Nix: add Nixpkgs module instructions --- pages/Nix/Hyprland on NixOS.md | 47 ++++++++++++++++++++++---- pages/Nix/Hyprland on other distros.md | 10 +++++- pages/Nix/Options & Overrides.md | 2 +- pages/Nix/_index.md | 18 ++++------ 4 files changed, 57 insertions(+), 20 deletions(-) diff --git a/pages/Nix/Hyprland on NixOS.md b/pages/Nix/Hyprland on NixOS.md index 036ba90..7a0de66 100644 --- a/pages/Nix/Hyprland on NixOS.md +++ b/pages/Nix/Hyprland on NixOS.md @@ -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; diff --git a/pages/Nix/Hyprland on other distros.md b/pages/Nix/Hyprland on other distros.md index 5263a1a..3d328b8 100644 --- a/pages/Nix/Hyprland on other distros.md +++ b/pages/Nix/Hyprland on other distros.md @@ -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). diff --git a/pages/Nix/Options & Overrides.md b/pages/Nix/Options & Overrides.md index 72ba158..568c872 100644 --- a/pages/Nix/Options & Overrides.md +++ b/pages/Nix/Options & Overrides.md @@ -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; diff --git a/pages/Nix/_index.md b/pages/Nix/_index.md index 9354a17..669314e 100644 --- a/pages/Nix/_index.md +++ b/pages/Nix/_index.md @@ -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.