commit f5a2cfea2cc2d0365ce69c046af9106382579e04
parent e2d08739ab69c3402a7073d65749235e1f3f087b
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Tue, 19 Aug 2025 18:26:08 +0200
parent e2d08739ab69c3402a7073d65749235e1f3f087b
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Tue, 19 Aug 2025 18:26:08 +0200
homeManagerModules/services: add `shaderbg`
1 file changed, 74 insertions(+), 0 deletions(-)
A
|
74
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/homeManagerModules/services/shaderbg/default.nix b/homeManagerModules/services/shaderbg/default.nix @@ -0,0 +1,74 @@ +{ + config, + pkgs, + lib, + ... +}: + +let + inherit (lib) types; + cfg = config.tgc.services.shaderbg; + +in +{ + + options.tgc.services.shaderbg = { + enable = lib.mkEnableOption ""; + package = lib.mkPackageOption pkgs.tgc "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" ]; + }; + }; + +}