forked from mirrors/nixpkgs
fc614c37c6
most modules can be evaluated for their documentation in a very restricted environment that doesn't include all of nixpkgs. this evaluation can then be cached and reused for subsequent builds, merging only documentation that has changed into the cached set. since nixos ships with a large number of modules of which only a few are used in any given config this can save evaluation a huge percentage of nixos options available in any given config. in tests of this caching, despite having to copy most of nixos/, saves about 80% of the time needed to build the system manual, or about two second on the machine used for testing. build time for a full system config shrank from 9.4s to 7.4s, while turning documentation off entirely shortened the build to 7.1s.
52 lines
1.3 KiB
Nix
52 lines
1.3 KiB
Nix
{ config, pkgs, lib, generators, ... }:
|
|
with lib;
|
|
let
|
|
cfg = config.i18n.inputMethod.kime;
|
|
yamlFormat = pkgs.formats.yaml { };
|
|
in
|
|
{
|
|
options = {
|
|
i18n.inputMethod.kime = {
|
|
config = mkOption {
|
|
type = yamlFormat.type;
|
|
default = { };
|
|
example = literalExpression ''
|
|
{
|
|
daemon = {
|
|
modules = ["Xim" "Indicator"];
|
|
};
|
|
|
|
indicator = {
|
|
icon_color = "White";
|
|
};
|
|
|
|
engine = {
|
|
hangul = {
|
|
layout = "dubeolsik";
|
|
};
|
|
};
|
|
}
|
|
'';
|
|
description = ''
|
|
kime configuration. Refer to <link xlink:href="https://github.com/Riey/kime/blob/v${pkgs.kime.version}/docs/CONFIGURATION.md"/> for details on supported values.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf (config.i18n.inputMethod.enabled == "kime") {
|
|
i18n.inputMethod.package = pkgs.kime;
|
|
|
|
environment.variables = {
|
|
GTK_IM_MODULE = "kime";
|
|
QT_IM_MODULE = "kime";
|
|
XMODIFIERS = "@im=kime";
|
|
};
|
|
|
|
environment.etc."xdg/kime/config.yaml".text = replaceStrings [ "\\\\" ] [ "\\" ] (builtins.toJSON cfg.config);
|
|
};
|
|
|
|
# uses attributes of the linked package
|
|
meta.buildDocsInSandbox = false;
|
|
}
|