{ lib, config, pkgs, ... }: with lib; let cfg = config.modules.desktop.thumbnailers; in { options.modules.desktop.thumbnailers = { enable = mkEnableOption "Enable a collection of thumbnailers"; }; config = mkIf cfg.enable { hm.home.packages = let mkThumbnailer = { name, mime, exec }: pkgs.writeTextFile { name = "${name}-thumbnailer"; destination = "/share/thumbnailers/${name}.thumbnailer"; text = '' [Thumbnailer Entry] Exec=${exec} MimeType=${mime} ''; }; in [ # videos pkgs.ffmpegthumbnailer # krita (mkThumbnailer { name = "kra"; mime = "application/x-krita"; exec = "sh -c \"${pkgs.unzip}/bin/unzip -p %i preview.png > %o\""; }) ]; }; }