{ pkgs, ... }: src: let inherit (pkgs) lib; in lib.cleanSourceWith { src = lib.cleanSource src; filter = path: type: let isTypstSource = lib.hasSuffix ".typ" path || lib.hasSuffix ".bib" path; isImage = lib.hasSuffix ".png" path || lib.hasSuffix ".jpeg" path || lib.hasSuffix ".jpg" path; isSpecialFile = builtins.elem (builtins.baseNameOf path) [ "typst.toml" ]; in type == "directory" || isTypstSource || isSpecialFile || isImage; }