programs.dconf: simlify the config

This commit is contained in:
2024-11-07 03:33:51 +00:00
parent 3a9e4af6da
commit c2cf989bb7

View File

@@ -16,26 +16,19 @@ let
text = lib.generators.toDconfINI p.gsettings;
}) enabledPrograms;
profilePackage = pkgs.writeTextFile {
name = "dconf-user-profile";
destination = "/etc/dconf/profile/user";
text = ''
user-db:user
system-db:site
'';
};
cfg = config.sane.programs.dconf;
in
{
sane.programs.dconf = {
configOption = with lib; mkOption {
type = types.submodule {
options = {
site = mkOption {
# TODO: this option shouldn't be necessary; generate it all directly from `gsettings`
type = types.listOf types.package;
default = [];
description = ''
dconf values to link into /etc/dconf
'';
};
};
};
default = {};
};
packageUnwrapped = pkgs.rmDbusServicesInPlace pkgs.dconf;
sandbox.whitelistDbus = [ "user" ];
persist.byStore.private = [
@@ -51,24 +44,12 @@ in
# 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";
config.site = sitePackages ++ [
(pkgs.writeTextFile {
name = "dconf-user-profile";
destination = "/etc/dconf/profile/user";
text = ''
user-db:user
system-db:site
'';
})
];
};
# 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;
paths = map (x: "${x}/etc/dconf") ([profilePackage] ++ sitePackages);
nativeBuildInputs = [ (lib.getBin pkgs.dconf) ];
postBuild = ''
if test -d $out/db; then