dconf: migrate to sane.programs

This commit is contained in:
Colin 2024-03-13 02:33:02 +00:00
parent 294563c655
commit 2f07fff084
2 changed files with 66 additions and 37 deletions

View File

@ -9,16 +9,33 @@ let
in
{
sane.programs.dconf = {
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 = {};
};
# N.B.: the dbus service points to the .lib output
# packageUnwrapped = pkgs.rmDbusServices pkgs.dconf;
sandbox.method = "bwrap";
persist.byStore.private = [
".config/dconf"
];
};
programs.dconf = lib.mkIf cfg.enabled {
# note that `programs.dconf` doesn't allow specifying the dconf package.
enable = true;
packages = [
# supposedly necessary for packages which haven't been wrapped (i.e. wrapGtkApp?).
# TODO: try removing this.
env.GIO_EXTRA_MODULES = "${pkgs.dconf.lib}/lib/gio/modules";
config.site = [
(pkgs.writeTextFile {
name = "dconf-user-profile";
destination = "/etc/dconf/profile/user";
@ -29,4 +46,18 @@ in
})
];
};
# 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
'';
};
};
}

View File

@ -307,8 +307,7 @@ in
};
};
config = lib.mkIf cfg.enable {
programs.dconf.packages = [
config.sane.programs.dconf.config.site = lib.mkIf cfg.enable [
(pkgs.writeTextFile {
name = "dconf-sway-settings";
destination = "/etc/dconf/db/site.d/10_gtk_settings";
@ -322,12 +321,12 @@ in
})
];
# environment.systemPackages = lib.attrValues themes;
environment.systemPackages = [
config.environment.systemPackages = lib.mkIf cfg.enable ([
themes.color-scheme."${cfg.color-scheme}"
themes.cursor-theme."${cfg.cursor-theme}"
themes.gtk-theme."${cfg.gtk-theme}"
themes.icon-theme."${cfg.icon-theme}"
] ++ lib.optionals cfg.all (lib.attrValues unsortedThemes);
] ++ lib.optionals cfg.all (lib.attrValues unsortedThemes));
# XXX(2024/02/05): set GSK_RENDERER=cairo to solve graphical edge-case on moby where some JPEGs would render as black!
# - repro by loading komikku and viewing images. some fail (particularly mangadex onimai), some work.
@ -339,5 +338,4 @@ in
# - upstream gtk recommends using mesa 24.0 (latest) specifically in response to the GSK renderers triggering new driver bugs,
# so maybe i can update that before re-enabling GSK_RENDERER anywhere else.
# environment.variables.GSK_RENDERER = "cairo";
};
}