diff --git a/hosts/common/programs/assorted.nix b/hosts/common/programs/assorted.nix index f659d80c5..498e955c3 100644 --- a/hosts/common/programs/assorted.nix +++ b/hosts/common/programs/assorted.nix @@ -279,7 +279,7 @@ in "alacritty" # terminal emulator "calls" # gnome calls (dialer/handler) "dbus" - "dconf" # required by many packages, but not well-documented :( + "dconf" # required by many packages, but not well-documented. TODO: REMOVE (use gsettings instead) # "delfin" # Jellyfin client "dialect" # language translation "dino" # XMPP client @@ -305,6 +305,7 @@ in "gnome-screenshot" # libcamera-based screenshotter, for debugging; should be compatible with gc2145 camera on Pinephone "gnome-weather" "gpodder" + "gsettings" "gst-device-monitor" # for debugging audio/video "gst-launch" # for debugging audio/video # "gthumb" diff --git a/hosts/common/programs/default.nix b/hosts/common/programs/default.nix index c41e24c77..5cb34f023 100644 --- a/hosts/common/programs/default.nix +++ b/hosts/common/programs/default.nix @@ -82,6 +82,7 @@ ./gpsd.nix ./gps-share.nix ./grimshot.nix + ./gsettings.nix ./gst-device-monitor.nix ./gst-launch.nix ./gthumb.nix diff --git a/hosts/common/programs/gsettings.nix b/hosts/common/programs/gsettings.nix new file mode 100644 index 000000000..32bef5b3f --- /dev/null +++ b/hosts/common/programs/gsettings.nix @@ -0,0 +1,28 @@ +{ config, lib, pkgs, ... }: +let + # [ ProgramConfig ] + enabledPrograms = builtins.filter + (p: p.enabled && p.gsettings != {}) + (builtins.attrValues config.sane.programs); + + keyfileTexts = lib.map (p: lib.generators.toDconfINI p.gsettings) enabledPrograms; + + cfg = config.sane.programs.gsettings; +in +{ + sane.programs.gsettings = { + packageUnwrapped = pkgs.linkBinIntoOwnPackage pkgs.glib "gsettings"; + env.GSETTINGS_BACKEND = "keyfile"; + }; + + environment.etc."glib-2.0/settings/defaults" = lib.mkIf cfg.enabled { + # GKeyfileSettingsBackend slurps from just two files: + # - /etc/glib-2.0/settings/default (immutable) + # - ~/.config/glib-2.0/settings/keyfile (mutable, and overrides the above) + # it doesn't mind me just concatenating everything together though; it handles duplicate groups gracefully. + # + # for tighter control, /etc/glib-2.0/settings/locks can be used to restrict which values a glib program may write to ~/.config/glib-2.0/settings/keyfile, + # but this isn't so much needed for as long as i'm not persisting that keyfile + text = lib.mkMerge keyfileTexts; + }; +}