programs: prefer the gsettings backend over dconf backend

it's more easily human editable, and programs can write new settings without requiring dbus access
This commit is contained in:
2024-11-07 04:19:10 +00:00
parent c2cf989bb7
commit ddaec49ea9
3 changed files with 31 additions and 1 deletions

View File

@@ -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"

View File

@@ -82,6 +82,7 @@
./gpsd.nix
./gps-share.nix
./grimshot.nix
./gsettings.nix
./gst-device-monitor.nix
./gst-launch.nix
./gthumb.nix

View File

@@ -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;
};
}