nixpkgs/nixos/modules/services/x11/gdk-pixbuf.nix
Alois Wohlschlager efd23ff1c8
nixos/gdk-pixbuf: move GDK_PIXBUF_MODULE_FILE to sessionVariables
Some environments do not load /etc/profile, so environment.variables do
not work. In particular, this is the case for Plasma Wayland.

Use environment.sessionVariables for setting that variable instead,
which is handled by PAM and hence more reliable.
2023-03-18 20:19:01 +01:00

29 lines
792 B
Nix

{ 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.sessionVariables = {
GDK_PIXBUF_MODULE_FILE = "${loadersCache}";
};
};
}