nix-dotfiles/modules/desktop/thumbnailers.nix
2026-01-13 07:20:25 -08:00

33 lines
800 B
Nix

{ 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\"";
})
];
};
}