2018-06-25 12:11:59 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
2024-05-02 14:29:25 +00:00
|
|
|
cfg = config.programs.gdk-pixbuf;
|
2018-06-25 12:11:59 +00:00
|
|
|
|
2022-10-21 07:42:13 +00:00
|
|
|
loadersCache = pkgs.gnome._gdkPixbufCacheBuilder_DO_NOT_USE {
|
2024-05-02 14:29:25 +00:00
|
|
|
extraLoaders = lib.unique cfg.modulePackages;
|
2022-10-21 07:42:13 +00:00
|
|
|
};
|
2018-06-25 12:11:59 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2024-05-02 14:29:25 +00:00
|
|
|
imports = [
|
|
|
|
(lib.mkRenamedOptionModule [ "services" "xserver" "gdk-pixbuf" ] [ "programs" "gdk-pixbuf" ])
|
|
|
|
];
|
|
|
|
|
2018-06-25 12:11:59 +00:00
|
|
|
options = {
|
2024-05-02 14:29:25 +00:00
|
|
|
programs.gdk-pixbuf.modulePackages = lib.mkOption {
|
2022-10-21 07:42:13 +00:00
|
|
|
type = lib.types.listOf lib.types.package;
|
2018-06-25 12:11:59 +00:00
|
|
|
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.
|
2022-10-21 07:42:13 +00:00
|
|
|
config = lib.mkIf (cfg.modulePackages != []) {
|
2022-08-07 09:43:35 +00:00
|
|
|
environment.sessionVariables = {
|
2024-05-02 14:29:25 +00:00
|
|
|
GDK_PIXBUF_MODULE_FILE = loadersCache;
|
2018-06-25 12:11:59 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|