Nix: add info about portalPackage

This commit is contained in:
Mihai Fufezan 2024-09-01 20:42:51 +03:00
parent d10596d359
commit 08dbe67a1e
Signed by: fufexan
SSH key fingerprint: SHA256:SdnKmEpJrDu1+2UO1QpB/Eg4HKcdDi6n+xSRqFNJVpg
2 changed files with 20 additions and 15 deletions

View file

@ -40,16 +40,8 @@ For a list of available options, check the
{{< tab "Flakes" >}} {{< tab "Flakes" >}}
{{< callout >}}
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.
{{< /callout >}}
The following snippet of code tries to show how to bring the Hyprland flake from 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 the flake input and use its packages with Home Manager. Feel free to make any
adjustment for your setup. 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!
@ -74,9 +66,14 @@ Don't forget to replace `user@hostname` with your username and hostname!
pkgs = nixpkgs.legacyPackages.x86_64-linux; pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [ modules = [
hyprland.homeManagerModules.default
{ {
wayland.windowManager.hyprland.enable = true; wayland.windowManager.hyprland = {
enable = true;
# set the flake package
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
# make sure to also set the portal package, so that they are in sync
portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
};
} }
# ... # ...
]; ];
@ -87,7 +84,7 @@ Don't forget to replace `user@hostname` with your username and hostname!
{{< /tab >}} {{< /tab >}}
{{< tab "No flakes (with flake-compat)" >}} {{< tab "Nix stable (with flake-compat)" >}}
{{< callout >}} {{< callout >}}
@ -107,7 +104,7 @@ make any adjustment for your setup.
{pkgs, ...}: let {pkgs, ...}: let
flake-compat = builtins.fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz"; flake-compat = builtins.fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz";
hyprland-flake = (import flake-compat { hyprland = (import flake-compat {
# we're not using pkgs.fetchgit as that requires a hash to be provided # we're not using pkgs.fetchgit as that requires a hash to be provided
src = builtins.fetchGit { src = builtins.fetchGit {
url = "https://github.com/hyprwm/Hyprland.git"; url = "https://github.com/hyprwm/Hyprland.git";
@ -117,8 +114,10 @@ make any adjustment for your setup.
in { in {
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
# set the flake package
package = hyprland-flake.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; package = hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
# make sure to also set the portal package, so that they are in sync
portalPackage = hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
} }
} }
``` ```

View file

@ -82,7 +82,10 @@ this:
{inputs, pkgs, ...}: { {inputs, pkgs, ...}: {
programs.hyprland = { programs.hyprland = {
enable = true; enable = true;
# set the flake package
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
# make sure to also set the portal package, so that they are in sync
portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
}; };
} }
``` ```
@ -139,7 +142,10 @@ have to compile Hyprland yourself.
in { in {
programs.hyprland = { programs.hyprland = {
enable = true; enable = true;
# set the flake package
package = hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; package = hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
# make sure to also set the portal package, so that they are in sync
portalPackage = hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
}; };
} }
``` ```