2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.dconf;
|
2020-07-18 16:06:22 +00:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
programs.dconf = {
|
|
|
|
enable = mkEnableOption "dconf";
|
|
|
|
|
|
|
|
profiles = mkOption {
|
|
|
|
type = types.attrsOf types.path;
|
|
|
|
default = {};
|
2020-07-18 16:06:22 +00:00
|
|
|
description = "Set of dconf profile files, installed at <filename>/etc/dconf/profiles/<replaceable>name</replaceable></filename>.";
|
2020-04-24 23:36:52 +00:00
|
|
|
internal = true;
|
|
|
|
};
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
packages = mkOption {
|
|
|
|
type = types.listOf types.package;
|
|
|
|
default = [];
|
|
|
|
description = "A list of packages which provide dconf profiles and databases in <filename>/etc/dconf</filename>.";
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf (cfg.profiles != {} || cfg.enable) {
|
2020-07-18 16:06:22 +00:00
|
|
|
environment.etc.dconf = mkIf (cfg.profiles != {} || cfg.packages != []) {
|
|
|
|
source = cfgDir;
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
services.dbus.packages = [ pkgs.dconf ];
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
systemd.packages = [ pkgs.dconf ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# For dconf executable
|
|
|
|
environment.systemPackages = [ pkgs.dconf ];
|
|
|
|
|
|
|
|
# Needed for unwrapped applications
|
|
|
|
environment.variables.GIO_EXTRA_MODULES = mkIf cfg.enable [ "${pkgs.dconf.lib}/lib/gio/modules" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|