aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/modules/programs/dconf.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/modules/programs/dconf.nix')
-rw-r--r--nixpkgs/nixos/modules/programs/dconf.nix37
1 files changed, 27 insertions, 10 deletions
diff --git a/nixpkgs/nixos/modules/programs/dconf.nix b/nixpkgs/nixos/modules/programs/dconf.nix
index 6702e8efd1c..ec85cb9d18c 100644
--- a/nixpkgs/nixos/modules/programs/dconf.nix
+++ b/nixpkgs/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,24 @@ 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 = mkIf (cfg.profiles != {} || cfg.packages != []) {
+ source = cfgDir;
+ };
services.dbus.packages = [ pkgs.dconf ];