about summary refs log tree commit diff
path: root/nixpkgs/nixos/modules/services/x11/gdk-pixbuf.nix
blob: 9e89d9f96c4af05c7ba90a175224bac45521b1cb (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 = "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.sessionVariables = {
      GDK_PIXBUF_MODULE_FILE = "${loadersCache}";
    };
  };
}