{ config, lib, pkgs, ... }: let cfg = config.my.wallpapers; args = lib.concatStringsSep " " (lib.mapAttrsToList (monitor: img: "--output ${monitor} --zoom ${lib.escapeShellArg img}") cfg); in { options.my.wallpapers = lib.mkOption { type = lib.types.attrsOf lib.types.path; default = { }; description = "Wallpaper image per monitor output name."; }; config = lib.mkIf (cfg != { }) { home.packages = [ pkgs.xwallpaper ]; xdg.configFile."wallpaper/set.sh" = { executable = true; text = '' #!/bin/sh ${pkgs.xwallpaper}/bin/xwallpaper ${args} ''; }; }; }