From 888accda88df3e66ecc79d08d9fbd495200f5228 Mon Sep 17 00:00:00 2001 From: John Titor <50095635+JohnRTitor@users.noreply.github.com> Date: Mon, 25 Mar 2024 16:27:09 +0530 Subject: [PATCH 1/3] nixos/hyprland: add systemd.setPath.enable option This commit adds systemd.setPath.enable option to hyprland module which sets the systemd path to include the current system's bin This is needed in Hyprland only setups, where opening links in applications like VS code do not work. --- nixos/modules/programs/wayland/hyprland.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nixos/modules/programs/wayland/hyprland.nix b/nixos/modules/programs/wayland/hyprland.nix index 9061ce5da83a..86f8b570f920 100644 --- a/nixos/modules/programs/wayland/hyprland.nix +++ b/nixos/modules/programs/wayland/hyprland.nix @@ -41,6 +41,15 @@ in portalPackage = mkPackageOption pkgs "xdg-desktop-portal-hyprland" { }; xwayland.enable = mkEnableOption (mdDoc "XWayland") // { default = true; }; + + systemd.setPath.enable = mkEnableOption null // { + default = true; + description = mdDoc '' + Set environment path of systemd to include the current system's bin directory. + This is needed in Hyprland setups, where opening links in applications do not work. + Enabled by default. + ''; + }; }; config = mkIf cfg.enable { @@ -63,6 +72,12 @@ in extraPortals = [ finalPortalPackage ]; configPackages = mkDefault [ cfg.finalPackage ]; }; + + systemd = mkIf cfg.systemd.setPath.enable { + user.extraConfig = '' + DefaultEnvironment="PATH=$PATH:/run/current-system/sw/bin" + ''; + }; }; imports = with lib; [ From 10d15891266d2113eb1f78a25eee291cdb64735f Mon Sep 17 00:00:00 2001 From: John Titor <50095635+JohnRTitor@users.noreply.github.com> Date: Wed, 27 Mar 2024 00:14:50 +0530 Subject: [PATCH 2/3] nixos/hyprland: removed references to mdDoc since it is the default --- nixos/modules/programs/wayland/hyprland.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nixos/modules/programs/wayland/hyprland.nix b/nixos/modules/programs/wayland/hyprland.nix index 86f8b570f920..a295843267e1 100644 --- a/nixos/modules/programs/wayland/hyprland.nix +++ b/nixos/modules/programs/wayland/hyprland.nix @@ -13,7 +13,7 @@ in { options.programs.hyprland = { enable = mkEnableOption null // { - description = mdDoc '' + description = '' Hyprland, the dynamic tiling Wayland compositor that doesn't sacrifice on its looks. You can manually launch Hyprland by executing {command}`Hyprland` on a TTY. @@ -33,18 +33,18 @@ in }; defaultText = literalExpression "`programs.hyprland.package` with applied configuration"; - description = mdDoc '' + description = '' The Hyprland package after applying configuration. ''; }; portalPackage = mkPackageOption pkgs "xdg-desktop-portal-hyprland" { }; - xwayland.enable = mkEnableOption (mdDoc "XWayland") // { default = true; }; + xwayland.enable = mkEnableOption ("XWayland") // { default = true; }; systemd.setPath.enable = mkEnableOption null // { default = true; - description = mdDoc '' + description = '' Set environment path of systemd to include the current system's bin directory. This is needed in Hyprland setups, where opening links in applications do not work. Enabled by default. From dfa44e80da5f1695dc4c0c66a59c7bea5a43a450 Mon Sep 17 00:00:00 2001 From: John Titor <50095635+JohnRTitor@users.noreply.github.com> Date: Wed, 27 Mar 2024 00:18:11 +0530 Subject: [PATCH 3/3] nixos/hyprland: Add possible bin directory paths, ie, user packages bin If user chooses, they can `exec-once=dbus-update-activation-environment --systemd --all` in hyprland.conf To import all path variables from the system's environment to systemd's environment Also set option example to false --- nixos/modules/programs/wayland/hyprland.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nixos/modules/programs/wayland/hyprland.nix b/nixos/modules/programs/wayland/hyprland.nix index a295843267e1..bb2641762cad 100644 --- a/nixos/modules/programs/wayland/hyprland.nix +++ b/nixos/modules/programs/wayland/hyprland.nix @@ -44,6 +44,7 @@ in systemd.setPath.enable = mkEnableOption null // { default = true; + example = false; description = '' Set environment path of systemd to include the current system's bin directory. This is needed in Hyprland setups, where opening links in applications do not work. @@ -75,7 +76,7 @@ in systemd = mkIf cfg.systemd.setPath.enable { user.extraConfig = '' - DefaultEnvironment="PATH=$PATH:/run/current-system/sw/bin" + DefaultEnvironment="PATH=$PATH:/run/current-system/sw/bin:/etc/profiles/per-user/$USER/bin:/run/wrappers/bin" ''; }; };