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,37 +307,35 @@ in
};
};
config = lib.mkIf cfg.enable {
programs.dconf.packages = [
(pkgs.writeTextFile {
name = "dconf-sway-settings";
destination = "/etc/dconf/db/site.d/10_gtk_settings";
text = ''
[org/gnome/desktop/interface]
color-scheme="${cfg.color-scheme}"
cursor-theme="${cfg.cursor-theme}"
gtk-theme="${cfg.gtk-theme}"
icon-theme="${cfg.icon-theme}"
'';
})
];
# environment.systemPackages = lib.attrValues themes;
environment.systemPackages = [
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);
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";
text = ''
[org/gnome/desktop/interface]
color-scheme="${cfg.color-scheme}"
cursor-theme="${cfg.cursor-theme}"
gtk-theme="${cfg.gtk-theme}"
icon-theme="${cfg.icon-theme}"
'';
})
];
# environment.systemPackages = lib.attrValues themes;
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));
# 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.
# - run `GSK_RENDERER=help loupe` to see options.
# - TODO: see if i can enable the `vulkan` GSK_RENDERER?
# - for more on GSK_RENDERER: <https://blog.gtk.org/2024/01/28/new-renderers-for-gtk/>
# XXX(2024/02/21): GSK_RENDERER=cairo breaks `delfin` (as does GSK_RENDERER=vulkan, when gtk4 is compiled with `vulkanSupport = true`)
# - perhaps it's best to let this be defaulted and set it ONLY where needed
# - 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";
};
# 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.
# - run `GSK_RENDERER=help loupe` to see options.
# - TODO: see if i can enable the `vulkan` GSK_RENDERER?
# - for more on GSK_RENDERER: <https://blog.gtk.org/2024/01/28/new-renderers-for-gtk/>
# XXX(2024/02/21): GSK_RENDERER=cairo breaks `delfin` (as does GSK_RENDERER=vulkan, when gtk4 is compiled with `vulkanSupport = true`)
# - perhaps it's best to let this be defaulted and set it ONLY where needed
# - 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";
}