nix/hm-module: add disableAutoreload option

This commit is contained in:
Mihai Fufezan 2022-12-19 23:39:37 +02:00
parent 668cc93962
commit 781f0adad4
No known key found for this signature in database
GPG key ID: 5899325F2F120900

View file

@ -13,6 +13,7 @@ self: {
in { in {
options.wayland.windowManager.hyprland = { options.wayland.windowManager.hyprland = {
enable = lib.mkEnableOption "hyprland wayland compositor"; enable = lib.mkEnableOption "hyprland wayland compositor";
package = lib.mkOption { package = lib.mkOption {
type = with lib.types; nullOr package; type = with lib.types; nullOr package;
default = defaultHyprlandPackage; default = defaultHyprlandPackage;
@ -27,6 +28,7 @@ in {
be done if you want to use the NixOS module to install Hyprland. be done if you want to use the NixOS module to install Hyprland.
''; '';
}; };
systemdIntegration = lib.mkOption { systemdIntegration = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = pkgs.stdenv.isLinux; default = pkgs.stdenv.isLinux;
@ -43,6 +45,18 @@ in {
</itemizedlist> </itemizedlist>
''; '';
}; };
disableAutoreload = lib.mkOption {
type = lib.types.bool;
default = false;
defaultText = lib.literalExpression "false";
example = lib.literalExpression "true";
description = ''
Whether to disable automatically reloading Hyprland's configuration when
rebuilding the Home Manager profile.
'';
};
xwayland = { xwayland = {
enable = lib.mkOption { enable = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
@ -70,7 +84,6 @@ in {
''; '';
}; };
extraConfig = lib.mkOption { extraConfig = lib.mkOption {
type = lib.types.nullOr lib.types.lines; type = lib.types.nullOr lib.types.lines;
default = ""; default = "";
@ -119,7 +132,8 @@ in {
if cfg.package == null if cfg.package == null
then defaultHyprlandPackage then defaultHyprlandPackage
else cfg.package; else cfg.package;
in "HYPRLAND_INSTANCE_SIGNATURE=$(ls -w 1 /tmp/hypr | tail -1) ${hyprlandPackage}/bin/hyprctl reload config-only"; in
lib.mkIf (!cfg.disableAutoreload) "HYPRLAND_INSTANCE_SIGNATURE=$(ls -w 1 /tmp/hypr | tail -1) ${hyprlandPackage}/bin/hyprctl reload config-only";
}; };
systemd.user.targets.hyprland-session = lib.mkIf cfg.systemdIntegration { systemd.user.targets.hyprland-session = lib.mkIf cfg.systemdIntegration {