1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-21 17:59:39 +01:00
home-manager/modules/programs/mpvpaper.nix
Tarow 7c45553340
mpvpaper: fix eval if no settings are defined (#7370)
Do not attempt to evaluate the xdg config files if no settings for
pauseList and stopList are defined.
2025-07-02 10:25:41 -05:00

65 lines
1.4 KiB
Nix

{
lib,
pkgs,
config,
...
}:
let
inherit (lib)
types
mkIf
mkEnableOption
mkPackageOption
mkOption
;
cfg = config.programs.mpvpaper;
in
{
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
options.programs.mpvpaper = {
enable = mkEnableOption "mpvpaper";
package = mkPackageOption pkgs "mpvpaper" { nullable = true; };
pauseList = mkOption {
type = types.lines;
default = "";
example = ''
firefox
steam
obs
'';
description = ''
List of program names that will cause mpvpaper to pause.
Programs must be separed by spaces or newlines.
'';
};
stopList = mkOption {
type = types.lines;
default = "";
example = ''
firefox
steam
obs
'';
description = ''
List of program names that will cause mpvpaper to stop.
Programs must be separed by spaces or newlines.
'';
};
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "programs.mpvpaper" pkgs lib.platforms.linux)
];
home.packages = mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."mpvpaper/pauselist" = mkIf (cfg.pauseList != "") {
text = cfg.pauseList;
};
xdg.configFile."mpvpaper/stoplist" = mkIf (cfg.stopList != "") {
text = cfg.stopList;
};
};
}