1{ config, pkgs, lib, ... }:
2
3{
4 imports = [
5 ];
6
7 options = {
8 qtPlugins = lib.mkOption {
9 type = lib.types.listOf lib.types.path;
10 default = [];
11 description = ''
12 Plugin packages for Qt such as input methods.
13 '';
14 };
15 };
16
17 config = {
18 environment.variables = if builtins.length config.qtPlugins > 0
19 then
20 let
21 paths = [ pkgs.qt48 ] ++ config.qtPlugins;
22 env = pkgs.buildEnv {
23 name = "qt-plugin-env";
24
25 inherit paths;
26
27 postBuild = lib.concatStringsSep "\n"
28 (map (d: d.qtPluginEnvPostBuild or "") paths);
29
30 ignoreCollisions = true;
31 };
32 in {
33 QT_PLUGIN_PATH = [ (builtins.toString env) ];
34 }
35 else {};
36 };
37}