summary refs log tree commit diff
path: root/nixos/modules/programs/dconf.nix
diff options
context:
space:
mode:
authorSymphorien Gibol <symphorien+git@xlumurb.eu>2020-04-23 12:00:00 +0000
committerSymphorien Gibol <symphorien+git@xlumurb.eu>2020-04-24 13:15:56 +0200
commita71dc0b27e82d7783d84b7113056814800538bd9 (patch)
treef9958b3046bf8b1a5cd6a1227924b4df18ff34bd /nixos/modules/programs/dconf.nix
parentbd6c12ba32b1b076baee6cfc0f1fc80b22e04987 (diff)
downloadnixpkgs-a71dc0b27e82d7783d84b7113056814800538bd9.tar
nixpkgs-a71dc0b27e82d7783d84b7113056814800538bd9.tar.gz
nixpkgs-a71dc0b27e82d7783d84b7113056814800538bd9.tar.bz2
nixpkgs-a71dc0b27e82d7783d84b7113056814800538bd9.tar.lz
nixpkgs-a71dc0b27e82d7783d84b7113056814800538bd9.tar.xz
nixpkgs-a71dc0b27e82d7783d84b7113056814800538bd9.tar.zst
nixpkgs-a71dc0b27e82d7783d84b7113056814800538bd9.zip
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
Diffstat (limited to 'nixos/modules/programs/dconf.nix')
-rw-r--r--nixos/modules/programs/dconf.nix35
1 files changed, 25 insertions, 10 deletions
diff --git a/nixos/modules/programs/dconf.nix b/nixos/modules/programs/dconf.nix
index 6702e8efd1c..30fbd72a9ab 100644
--- a/nixos/modules/programs/dconf.nix
+++ b/nixos/modules/programs/dconf.nix
@@ -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 ];