2024-02-20 12:09:52 +00:00
|
|
|
# dconf docs: <https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/desktop_migration_and_administration_guide/profiles>
|
|
|
|
# this lets programs temporarily write user-level dconf settings (aka gsettings).
|
|
|
|
# they're written to ~/.config/dconf/user, unless `DCONF_PROFILE` is set to something other than the default of /etc/dconf/profile/user
|
|
|
|
# find keys/values with `dconf dump /`
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.sane.programs.dconf;
|
|
|
|
in
|
|
|
|
{
|
2024-02-20 23:39:27 +00:00
|
|
|
sane.programs.dconf = {
|
2024-03-13 02:33:02 +00:00
|
|
|
configOption = with lib; mkOption {
|
|
|
|
type = types.submodule {
|
|
|
|
options = {
|
|
|
|
site = mkOption {
|
|
|
|
type = types.listOf types.package;
|
|
|
|
default = [];
|
|
|
|
description = ''
|
|
|
|
extra packages to link into /etc/dconf
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
default = {};
|
|
|
|
};
|
|
|
|
|
2024-03-13 03:29:42 +00:00
|
|
|
packageUnwrapped = pkgs.rmDbusServicesInPlace pkgs.dconf;
|
2024-02-20 23:43:25 +00:00
|
|
|
sandbox.method = "bwrap";
|
2024-03-13 03:13:57 +00:00
|
|
|
sandbox.wrapperType = "inplace"; #< dbus/systemd services live in `.out` but point to `.lib` data.
|
|
|
|
sandbox.whitelistDbus = [ "user" ];
|
2024-02-20 23:39:27 +00:00
|
|
|
persist.byStore.private = [
|
|
|
|
".config/dconf"
|
|
|
|
];
|
|
|
|
|
2024-03-13 03:29:42 +00:00
|
|
|
services.dconf = {
|
|
|
|
description = "dconf configuration database/server";
|
2024-05-30 04:55:05 +00:00
|
|
|
partOf = [ "default" ];
|
2024-03-21 15:05:23 +00:00
|
|
|
command = "${lib.getLib cfg.package}/libexec/dconf-service";
|
2024-03-13 03:29:42 +00:00
|
|
|
};
|
|
|
|
|
2024-03-13 02:41:39 +00:00
|
|
|
# supposedly necessary for packages which haven't been wrapped (i.e. wrapGtkApp?),
|
|
|
|
# but in practice seems unnecessary.
|
|
|
|
# env.GIO_EXTRA_MODULES = "${pkgs.dconf.lib}/lib/gio/modules";
|
2024-03-13 02:33:02 +00:00
|
|
|
|
|
|
|
config.site = [
|
2024-02-20 12:09:52 +00:00
|
|
|
(pkgs.writeTextFile {
|
|
|
|
name = "dconf-user-profile";
|
|
|
|
destination = "/etc/dconf/profile/user";
|
|
|
|
text = ''
|
|
|
|
user-db:user
|
|
|
|
system-db:site
|
|
|
|
'';
|
|
|
|
})
|
|
|
|
];
|
|
|
|
};
|
2024-03-13 02:33:02 +00:00
|
|
|
|
|
|
|
# TODO: get dconf to read these from ~/.config/dconf ?
|
|
|
|
environment.etc.dconf = lib.mkIf cfg.enabled {
|
|
|
|
source = pkgs.symlinkJoin {
|
|
|
|
name = "dconf-system-config";
|
|
|
|
paths = map (x: "${x}/etc/dconf") cfg.config.site;
|
|
|
|
nativeBuildInputs = [ (lib.getBin pkgs.dconf) ];
|
|
|
|
postBuild = ''
|
|
|
|
if test -d $out/db; then
|
|
|
|
dconf update $out/db
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2024-02-20 12:09:52 +00:00
|
|
|
}
|