mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
kime: fix configuration
Switches the kime configuration format to use unstructured text. This is necessary since version 3 and upwards use YAML tags.
This commit is contained in:
parent
7b3fca5adc
commit
865bef3435
2 changed files with 56 additions and 27 deletions
|
@ -1,34 +1,33 @@
|
|||
{ config, pkgs, lib, generators, ... }:
|
||||
with lib;
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) literalExpression mkIf mkOption mkRemovedOptionModule types;
|
||||
|
||||
cfg = config.i18n.inputMethod.kime;
|
||||
yamlFormat = pkgs.formats.yaml { };
|
||||
in {
|
||||
imports = [
|
||||
(mkRemovedOptionModule [ "i18n" "inputMethod" "kime" "config" ] ''
|
||||
Please use 'i18n.inputMethod.kime.extraConfig' instead.
|
||||
'')
|
||||
];
|
||||
|
||||
options = {
|
||||
i18n.inputMethod.kime = {
|
||||
config = mkOption {
|
||||
type = yamlFormat.type;
|
||||
default = { };
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = literalExpression ''
|
||||
{
|
||||
daemon = {
|
||||
modules = ["Xim" "Indicator"];
|
||||
};
|
||||
|
||||
indicator = {
|
||||
icon_color = "White";
|
||||
};
|
||||
|
||||
engine = {
|
||||
hangul = {
|
||||
layout = "dubeolsik";
|
||||
};
|
||||
};
|
||||
}
|
||||
daemon:
|
||||
modules: [Xim,Indicator]
|
||||
indicator:
|
||||
icon_color: White
|
||||
engine:
|
||||
hangul:
|
||||
layout: dubeolsik
|
||||
'';
|
||||
description = ''
|
||||
kime configuration. Refer to
|
||||
<https://github.com/Riey/kime/blob/develop/docs/CONFIGURATION.md>
|
||||
<https://github.com/Riey/kime/blob/v${pkgs.kime.version}/docs/CONFIGURATION.md>
|
||||
for details on supported values.
|
||||
'';
|
||||
};
|
||||
|
@ -44,8 +43,7 @@ in {
|
|||
XMODIFIERS = "@im=kime";
|
||||
};
|
||||
|
||||
xdg.configFile."kime/config.yaml".text =
|
||||
replaceStrings [ "\\\\" ] [ "\\" ] (builtins.toJSON cfg.config);
|
||||
xdg.configFile."kime/config.yaml".text = cfg.extraConfig;
|
||||
|
||||
systemd.user.services.kime-daemon = {
|
||||
Unit = {
|
||||
|
|
|
@ -1,14 +1,45 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
let
|
||||
|
||||
kimeConfig = ''
|
||||
daemon:
|
||||
modules: [Xim,Indicator]
|
||||
indicator:
|
||||
icon_color: White
|
||||
engine:
|
||||
hangul:
|
||||
layout: dubeolsik
|
||||
'';
|
||||
|
||||
in {
|
||||
i18n.inputMethod = {
|
||||
enabled = "kime";
|
||||
kime.config = { engine = { hangul = { layout = "dubeolsik"; }; }; };
|
||||
kime.extraConfig = kimeConfig;
|
||||
};
|
||||
|
||||
test.stubs.kime = { outPath = null; };
|
||||
test.stubs = {
|
||||
kime = { outPath = null; };
|
||||
gtk2 = {
|
||||
buildScript = ''
|
||||
mkdir -p $out/bin
|
||||
echo '#/usr/bin/env bash' > $out/bin/gtk-query-immodules-2.0
|
||||
chmod +x $out/bin/*
|
||||
'';
|
||||
};
|
||||
gtk3 = {
|
||||
buildScript = ''
|
||||
mkdir -p $out/bin
|
||||
echo '#/usr/bin/env bash' > $out/bin/gtk-query-immodules-3.0
|
||||
chmod +x $out/bin/*
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/systemd/user/kime-daemon.service
|
||||
assertFileExists home-files/.config/kime/config.yaml
|
||||
assertFileContent home-files/.config/kime/config.yaml \
|
||||
${builtins.toFile "kime-expected.yaml" kimeConfig}
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue