diff --git a/hosts/common/programs/dconf.nix b/hosts/common/programs/dconf.nix index bf9b1645..2dbd4248 100644 --- a/hosts/common/programs/dconf.nix +++ b/hosts/common/programs/dconf.nix @@ -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 + ''; + }; + }; } diff --git a/hosts/modules/gui/gtk.nix b/hosts/modules/gui/gtk.nix index 7f0e41ae..f63bb6b4 100644 --- a/hosts/modules/gui/gtk.nix +++ b/hosts/modules/gui/gtk.nix @@ -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: - # 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: + # 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"; }