alexandria/2024/nix/lib/cleanTypstSource.nix

19 lines
489 B
Nix
Raw Normal View History

{ 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;
}