1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7
8let
9 cfg = config.programs.gdk-pixbuf;
10
11 loadersCache = pkgs.gnome._gdkPixbufCacheBuilder_DO_NOT_USE {
12 extraLoaders = lib.unique cfg.modulePackages;
13 };
14in
15
16{
17 imports = [
18 (lib.mkRenamedOptionModule [ "services" "xserver" "gdk-pixbuf" ] [ "programs" "gdk-pixbuf" ])
19 ];
20
21 options = {
22 programs.gdk-pixbuf.modulePackages = lib.mkOption {
23 type = lib.types.listOf lib.types.package;
24 default = [ ];
25 description = "Packages providing GDK-Pixbuf modules, for cache generation.";
26 };
27 };
28
29 # If there is any package configured in modulePackages, we generate the
30 # loaders.cache based on that and set the environment variable
31 # GDK_PIXBUF_MODULE_FILE to point to it.
32 config = lib.mkIf (cfg.modulePackages != [ ]) {
33 environment.sessionVariables = {
34 GDK_PIXBUF_MODULE_FILE = loadersCache;
35 };
36 };
37}