Add plugin configuration to home manager module

This commit is contained in:
outfoxxed 2023-05-01 23:32:23 -07:00 committed by Mihai Fufezan
parent 2e28e88dfd
commit 4fe5827598

View file

@ -51,6 +51,15 @@ in {
''; '';
}; };
plugins = lib.mkOption {
type = with lib.types; listOf (either package path);
default = [];
description = lib.mdDoc ''
List of hyprlad plugins to use. Can either be packages or
absolute plugin paths.
'';
};
systemdIntegration = lib.mkOption { systemdIntegration = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = pkgs.stdenv.isLinux; default = pkgs.stdenv.isLinux;
@ -114,11 +123,14 @@ in {
home.sessionVariables = home.sessionVariables =
lib.mkIf cfg.recommendedEnvironment {NIXOS_OZONE_WL = "1";}; lib.mkIf cfg.recommendedEnvironment {NIXOS_OZONE_WL = "1";};
xdg.configFile."hypr/hyprland.conf" = lib.mkIf (cfg.extraConfig != null) { xdg.configFile."hypr/hyprland.conf" = lib.mkIf (cfg.systemdIntegration || cfg.extraConfig != null || cfg.plugins != []) {
text = text =
(lib.optionalString cfg.systemdIntegration '' (lib.optionalString cfg.systemdIntegration ''
exec-once=${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP && systemctl --user start hyprland-session.target exec-once=${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP && systemctl --user start hyprland-session.target
'') '')
+ lib.concatStrings (builtins.map (entry: let
plugin = if lib.types.package.check entry then "${entry}/lib/lib${entry.pname}.so" else entry;
in "plugin = ${plugin}\n") cfg.plugins)
+ cfg.extraConfig; + cfg.extraConfig;
onChange = let onChange = let