about summary refs log tree commit diff
path: root/nixos/modules/programs/gdk-pixbuf.nix
blob: f96259ccd2c783840ffaac6a826bd787ad879e16 (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
29
30
31
32
{ config, lib, pkgs, ... }:

let
  cfg = config.programs.gdk-pixbuf;

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

{
  imports = [
    (lib.mkRenamedOptionModule [ "services" "xserver" "gdk-pixbuf" ] [ "programs" "gdk-pixbuf" ])
  ];

  options = {
    programs.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;
    };
  };
}