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