{ tgcFlake, ... }: { config, pkgs, lib, ... }: let inherit (lib) types; cfg = config.tgc.services.shaderbg; in { options.tgc.services.shaderbg = { enable = lib.mkEnableOption ""; package = lib.mkPackageOption tgcFlake.packages.${pkgs.system} "shaderbg" { }; systemd.enable = lib.mkOption { type = types.bool; default = true; example = false; description = "Enable shaderbg's Systemd Unit."; }; systemd.output = lib.mkOption { type = types.str; default = "*"; example = "*"; description = "Output to use"; }; systemd.extraArgs = lib.mkOption { type = with types; listOf str; default = [ ]; example = [ "--fps" "10" "--layer" "background" ]; }; systemd.shaderFile = lib.mkOption { type = with types; oneOf [ path str ]; example = "./example.frag"; }; }; config = lib.mkIf cfg.enable { home.packages = [ cfg.package ]; systemd.user.services.shaderbg = lib.mkIf cfg.systemd.enable { Unit = { Description = "A live wallpaper program for Sway and other compositors with wlr-layer-shell support."; After = [ "graphical-session-pre.target" ]; PartOf = [ "graphical-session.target" ]; }; Service = { Restart = "on-failure"; RestartSec = 5; ExecStart = lib.concatStringsSep " " [ (lib.getExe cfg.package) (lib.escapeShellArgs cfg.systemd.extraArgs) cfg.systemd.output cfg.systemd.shaderFile ]; }; Install.WantedBy = [ "graphical-session.target" ]; }; }; }