diff --git a/modules/feh/hm.nix b/modules/feh/hm.nix index 5c028991..d0187ebf 100644 --- a/modules/feh/hm.nix +++ b/modules/feh/hm.nix @@ -15,6 +15,14 @@ mkTarget { || i3.enable || spectrwm.enable || xmonad.enable; + autoEnableExpr = '' + with config.xsession.windowManager; + bspwm.enable + || herbstluftwm.enable + || i3.enable + || spectrwm.enable + || xmonad.enable + ''; configElements = { imageScalingMode, image }: diff --git a/modules/feh/nixos.nix b/modules/feh/nixos.nix index eefd8190..cc0ee85e 100644 --- a/modules/feh/nixos.nix +++ b/modules/feh/nixos.nix @@ -11,6 +11,10 @@ mkTarget { autoEnable = with config.services.xserver.windowManager; xmonad.enable || i3.enable; + autoEnableExpr = '' + with services.xserver.windowManager; + xmonad.enable || i3.enable + ''; configElements = { image, imageScalingMode }: diff --git a/modules/gnome/hm.nix b/modules/gnome/hm.nix index bc64a6cb..9b8e4561 100644 --- a/modules/gnome/hm.nix +++ b/modules/gnome/hm.nix @@ -44,7 +44,11 @@ let in { options.stylix.targets.gnome = { - enable = config.lib.stylix.mkEnableTarget "GNOME" pkgs.stdenv.hostPlatform.isLinux; + enable = config.lib.stylix.mkEnableTargetWith { + name = "GNOME"; + autoEnable = pkgs.stdenv.hostPlatform.isLinux; + autoEnableExpr = "pkgs.stdenv.hostPlatform.isLinux"; + }; useWallpaper = config.lib.stylix.mkEnableWallpaper "GNOME" true; }; diff --git a/modules/hyprland/hm.nix b/modules/hyprland/hm.nix index cb16ceb9..70ef1be2 100644 --- a/modules/hyprland/hm.nix +++ b/modules/hyprland/hm.nix @@ -7,9 +7,11 @@ mkTarget { name = "hyprland"; humanName = "Hyprland"; - extraOptions.hyprpaper.enable = config.lib.stylix.mkEnableTarget "Hyprpaper" ( - config.stylix.image != null - ); + extraOptions.hyprpaper.enable = config.lib.stylix.mkEnableTargetWith { + name = "Hyprpaper"; + autoEnable = config.stylix.image != null; + autoEnableExpr = "stylix.image != null"; + }; configElements = [ ( { colors }: diff --git a/modules/qt/hm.nix b/modules/qt/hm.nix index 562a4a4c..dd876237 100644 --- a/modules/qt/hm.nix +++ b/modules/qt/hm.nix @@ -13,9 +13,11 @@ # # [1]: https://github.com/nix-community/stylix/issues/933 # [2]: https://github.com/nix-community/home-manager/issues/6565 - enable = config.lib.stylix.mkEnableTarget "QT" ( - pkgs.stdenv.hostPlatform.isLinux && osConfig != null - ); + enable = config.lib.stylix.mkEnableTargetWith { + name = "QT"; + autoEnable = pkgs.stdenv.hostPlatform.isLinux && osConfig != null; + autoEnableExpr = "pkgs.stdenv.hostPlatform.isLinux && osConfig != null"; + }; platform = lib.mkOption { description = '' diff --git a/modules/swaylock/hm.nix b/modules/swaylock/hm.nix index a0440b23..20504c5c 100644 --- a/modules/swaylock/hm.nix +++ b/modules/swaylock/hm.nix @@ -26,15 +26,19 @@ in }) ]; options.stylix.targets.swaylock = { - enable = - config.lib.stylix.mkEnableTarget "Swaylock" - # When the state version is older than 23.05, Swaylock enables itself - # automatically if `settings != {}` [1]. Therefore, Swaylock theming - # shouldn't be enabled by default for such state versions, to avoid - # inadvertently installing Swaylock when it's not desired. - # - # [1]: https://github.com/nix-community/home-manager/blob/5cfbf5cc37a3bd1da07ae84eea1b828909c4456b/modules/programs/swaylock.nix#L12-L17 - (lib.versionAtLeast config.home.stateVersion "23.05"); + enable = config.lib.stylix.mkEnableTargetWith { + name = "Swaylock"; + # When the state version is older than 23.05, Swaylock enables itself + # automatically if `settings != {}` [1]. Therefore, Swaylock theming + # shouldn't be enabled by default for such state versions, to avoid + # inadvertently installing Swaylock when it's not desired. + # + # [1]: https://github.com/nix-community/home-manager/blob/5cfbf5cc37a3bd1da07ae84eea1b828909c4456b/modules/programs/swaylock.nix#L12-L17 + autoEnable = lib.versionAtLeast config.home.stateVersion "23.05"; + autoEnableExpr = '' + lib.versionAtLeast home.stateVersion "23.05" + ''; + }; useWallpaper = config.lib.stylix.mkEnableWallpaper "Swaylock" true; };