about summary refs log tree commit diff
path: root/nixos/modules/services/x11/gdk-pixbuf.nix
blob: 2105224f92ff3368da5c6ae87a391958c6a13cdd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{ config, lib, pkgs, ... }:

let
  cfg = config.services.xserver.gdk-pixbuf;

  loadersCache = pkgs.gnome._gdkPixbufCacheBuilder_DO_NOT_USE {
    extraLoaders = lib.unique (cfg.modulePackages);
  };
in

{
  options = {
    services.xserver.gdk-pixbuf.modulePackages = lib.mkOption {
      type = lib.types.listOf lib.types.package;
      default = [ ];
      description = lib.mdDoc "Packages providing GDK-Pixbuf modules, for cache generation.";
    };
  };

  # If there is any package configured in modulePackages, we generate the
  # loaders.cache based on that and set the environment variable
  # GDK_PIXBUF_MODULE_FILE to point to it.
  config = lib.mkIf (cfg.modulePackages != []) {
    environment.variables = {
      GDK_PIXBUF_MODULE_FILE = "${loadersCache}";
    };
  };
}