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 in
{ {
sane.programs.dconf = { 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"; sandbox.method = "bwrap";
persist.byStore.private = [ persist.byStore.private = [
".config/dconf" ".config/dconf"
]; ];
};
programs.dconf = lib.mkIf cfg.enabled { # supposedly necessary for packages which haven't been wrapped (i.e. wrapGtkApp?).
# note that `programs.dconf` doesn't allow specifying the dconf package. # TODO: try removing this.
enable = true; env.GIO_EXTRA_MODULES = "${pkgs.dconf.lib}/lib/gio/modules";
packages = [
config.site = [
(pkgs.writeTextFile { (pkgs.writeTextFile {
name = "dconf-user-profile"; name = "dconf-user-profile";
destination = "/etc/dconf/profile/user"; 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 { config.sane.programs.dconf.config.site = lib.mkIf cfg.enable [
programs.dconf.packages = [ (pkgs.writeTextFile {
(pkgs.writeTextFile { name = "dconf-sway-settings";
name = "dconf-sway-settings"; destination = "/etc/dconf/db/site.d/10_gtk_settings";
destination = "/etc/dconf/db/site.d/10_gtk_settings"; text = ''
text = '' [org/gnome/desktop/interface]
[org/gnome/desktop/interface] color-scheme="${cfg.color-scheme}"
color-scheme="${cfg.color-scheme}" cursor-theme="${cfg.cursor-theme}"
cursor-theme="${cfg.cursor-theme}" gtk-theme="${cfg.gtk-theme}"
gtk-theme="${cfg.gtk-theme}" icon-theme="${cfg.icon-theme}"
icon-theme="${cfg.icon-theme}" '';
''; })
}) ];
]; # environment.systemPackages = lib.attrValues themes;
# environment.systemPackages = lib.attrValues themes; config.environment.systemPackages = lib.mkIf cfg.enable ([
environment.systemPackages = [ themes.color-scheme."${cfg.color-scheme}"
themes.color-scheme."${cfg.color-scheme}" themes.cursor-theme."${cfg.cursor-theme}"
themes.cursor-theme."${cfg.cursor-theme}" themes.gtk-theme."${cfg.gtk-theme}"
themes.gtk-theme."${cfg.gtk-theme}" themes.icon-theme."${cfg.icon-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! # 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. # - repro by loading komikku and viewing images. some fail (particularly mangadex onimai), some work.
# - run `GSK_RENDERER=help loupe` to see options. # - run `GSK_RENDERER=help loupe` to see options.
# - TODO: see if i can enable the `vulkan` GSK_RENDERER? # - 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/> # - 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`) # 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 # - 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, # - 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. # so maybe i can update that before re-enabling GSK_RENDERER anywhere else.
# environment.variables.GSK_RENDERER = "cairo"; # environment.variables.GSK_RENDERER = "cairo";
};
} }