Merge pull request #85892 from symphorien/ibus-db
ibus: fix dconf db installation
This commit is contained in:
commit
78a9359b2a
@ -64,7 +64,7 @@ in
|
||||
# Without dconf enabled it is impossible to use IBus
|
||||
programs.dconf.enable = true;
|
||||
|
||||
programs.dconf.profiles.ibus = "${ibusPackage}/etc/dconf/profile/ibus";
|
||||
programs.dconf.packages = [ ibusPackage ];
|
||||
|
||||
services.dbus.packages = [
|
||||
ibusAutostart
|
||||
|
@ -4,13 +4,24 @@ with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.dconf;
|
||||
|
||||
mkDconfProfile = name: path:
|
||||
{
|
||||
name = "dconf/profile/${name}";
|
||||
value.source = path;
|
||||
};
|
||||
|
||||
cfgDir = pkgs.symlinkJoin {
|
||||
name = "dconf-system-config";
|
||||
paths = map (x: "${x}/etc/dconf") cfg.packages;
|
||||
postBuild = ''
|
||||
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
|
||||
{
|
||||
###### interface
|
||||
@ -22,18 +33,22 @@ in
|
||||
profiles = mkOption {
|
||||
type = types.attrsOf types.path;
|
||||
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;
|
||||
};
|
||||
|
||||
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
|
||||
|
||||
config = mkIf (cfg.profiles != {} || cfg.enable) {
|
||||
environment.etc = optionalAttrs (cfg.profiles != {})
|
||||
(mapAttrs' mkDconfProfile cfg.profiles);
|
||||
environment.etc.dconf.source = mkIf (cfg.profiles != {} || cfg.packages != []) cfgDir;
|
||||
|
||||
services.dbus.packages = [ pkgs.dconf ];
|
||||
|
||||
|
@ -5,16 +5,12 @@ makeInstalledTest {
|
||||
|
||||
testConfig = {
|
||||
i18n.inputMethod.enabled = "ibus";
|
||||
systemd.user.services.ibus-daemon = {
|
||||
serviceConfig.ExecStart = "${pkgs.ibus}/bin/ibus-daemon --xim --verbose";
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
partOf = [ "graphical-session.target" ];
|
||||
};
|
||||
};
|
||||
|
||||
preTestScript = ''
|
||||
# ibus has ibus-desktop-testing-runner but it tries to manage desktop session so we just spawn ibus-daemon ourselves
|
||||
machine.succeed("ibus-daemon --daemonize --verbose")
|
||||
'';
|
||||
|
||||
withX11 = true;
|
||||
|
||||
# TODO: ibus-daemon is currently crashing or something
|
||||
# maybe make ibus systemd service that auto-restarts?
|
||||
meta.broken = true;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
, gtk2
|
||||
, gtk3
|
||||
, gtk-doc
|
||||
, runCommand
|
||||
, isocodes
|
||||
, cldr-emoji-annotation
|
||||
, unicode-character-database
|
||||
@ -47,6 +48,14 @@ let
|
||||
makeWrapper ${glib.dev}/bin/glib-mkenums $out/bin/glib-mkenums --unset PYTHONPATH
|
||||
'';
|
||||
};
|
||||
# make-dconf-override-db.sh needs to execute dbus-launch in the sandbox,
|
||||
# it will fail to read /etc/dbus-1/session.conf unless we add this flag
|
||||
dbus-launch = runCommand "sandbox-dbus-launch" {
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
} ''
|
||||
makeWrapper ${dbus}/bin/dbus-launch $out/bin/dbus-launch \
|
||||
--add-flags --config-file=${dbus.daemon}/share/dbus-1/session.conf
|
||||
'';
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
@ -71,7 +80,7 @@ stdenv.mkDerivation rec {
|
||||
outputs = [ "out" "dev" "installedTests" ];
|
||||
|
||||
postPatch = ''
|
||||
echo \#!${runtimeShell} > data/dconf/make-dconf-override-db.sh
|
||||
patchShebangs --build data/dconf/make-dconf-override-db.sh
|
||||
cp ${buildPackages.gtk-doc}/share/gtk-doc/data/gtk-doc.make .
|
||||
'';
|
||||
|
||||
@ -105,6 +114,7 @@ stdenv.mkDerivation rec {
|
||||
python3BuildEnv
|
||||
vala
|
||||
wrapGAppsHook
|
||||
dbus-launch
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
|
Loading…
Reference in New Issue
Block a user