ibus: fix installation of dconf database

Fixes this warning at ibus-daemon startup:

(ibus-dconf:15691): dconf-WARNING **: 21:49:24.018: unable to open file '/etc/dconf/db/ibus': Failed to open file ?/etc/dconf/db/ibus?: open() failed: No such file or directory; expect degraded performance
This commit is contained in:
Symphorien Gibol 2020-04-23 12:00:00 +00:00
parent bd6c12ba32
commit a71dc0b27e
2 changed files with 26 additions and 11 deletions

View File

@ -64,7 +64,7 @@ in
# Without dconf enabled it is impossible to use IBus # Without dconf enabled it is impossible to use IBus
programs.dconf.enable = true; programs.dconf.enable = true;
programs.dconf.profiles.ibus = "${ibusPackage}/etc/dconf/profile/ibus"; programs.dconf.packages = [ ibusPackage ];
services.dbus.packages = [ services.dbus.packages = [
ibusAutostart ibusAutostart

View File

@ -4,13 +4,24 @@ with lib;
let let
cfg = config.programs.dconf; cfg = config.programs.dconf;
cfgDir = pkgs.symlinkJoin {
mkDconfProfile = name: path: name = "dconf-system-config";
{ paths = map (x: "${x}/etc/dconf") cfg.packages;
name = "dconf/profile/${name}"; postBuild = ''
value.source = path; mkdir -p $out/profile
}; mkdir -p $out/db
'' + (
concatStringsSep "\n" (
mapAttrsToList (
name: path: ''
ln -s ${path} $out/profile/${name}
''
) cfg.profiles
)
) + ''
${pkgs.dconf}/bin/dconf update $out/db
'';
};
in in
{ {
###### interface ###### interface
@ -22,18 +33,22 @@ in
profiles = mkOption { profiles = mkOption {
type = types.attrsOf types.path; type = types.attrsOf types.path;
default = {}; default = {};
description = "Set of dconf profile files."; description = "Set of dconf profile files, installed at <filename>/etc/dconf/profiles/<replaceable>name</replaceable></filename>.";
internal = true; internal = true;
}; };
packages = mkOption {
type = types.listOf types.package;
default = [];
description = "A list of packages which provide dconf profiles and databases in <filename>/etc/dconf</filename>.";
};
}; };
}; };
###### implementation ###### implementation
config = mkIf (cfg.profiles != {} || cfg.enable) { config = mkIf (cfg.profiles != {} || cfg.enable) {
environment.etc = optionalAttrs (cfg.profiles != {}) environment.etc.dconf.source = mkIf (cfg.profiles != {} || cfg.packages != []) cfgDir;
(mapAttrs' mkDconfProfile cfg.profiles);
services.dbus.packages = [ pkgs.dconf ]; services.dbus.packages = [ pkgs.dconf ];