1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6 cfg = config.programs.dconf;
7
8 mkDconfProfile = name: path:
9 { source = path; target = "dconf/profile/${name}"; };
10
11in
12{
13 ###### interface
14
15 options = {
16 programs.dconf = {
17 enable = mkEnableOption "dconf";
18
19 profiles = mkOption {
20 type = types.attrsOf types.path;
21 default = {};
22 description = "Set of dconf profile files.";
23 internal = true;
24 };
25
26 };
27 };
28
29 ###### implementation
30
31 config = mkIf (cfg.profiles != {} || cfg.enable) {
32 environment.etc = optionals (cfg.profiles != {})
33 (mapAttrsToList mkDconfProfile cfg.profiles);
34
35 environment.variables.GIO_EXTRA_MODULES = optional cfg.enable
36 "${pkgs.gnome3.dconf.lib}/lib/gio/modules";
37 # https://github.com/NixOS/nixpkgs/pull/31891
38 #environment.variables.XDG_DATA_DIRS = optional cfg.enable
39 # "$(echo ${pkgs.gnome3.gsettings-desktop-schemas}/share/gsettings-schemas/gsettings-desktop-schemas-*)";
40 };
41
42}