modules/programs: introduce a gsettings
config option, which so far routes to dconf but later will stand alone
This commit is contained in:
@@ -5,6 +5,17 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
# [ ProgramConfig ]
|
||||
enabledPrograms = builtins.filter
|
||||
(p: p.enabled && p.gsettings != {})
|
||||
(builtins.attrValues config.sane.programs);
|
||||
|
||||
sitePackages = lib.map (p: pkgs.writeTextFile {
|
||||
name = "${p.name}-dconf";
|
||||
destination = "/etc/dconf/db/site.d/10_${p.name}";
|
||||
text = lib.generators.toDconfINI p.gsettings;
|
||||
}) enabledPrograms;
|
||||
|
||||
cfg = config.sane.programs.dconf;
|
||||
in
|
||||
{
|
||||
@@ -13,10 +24,11 @@ in
|
||||
type = types.submodule {
|
||||
options = {
|
||||
site = mkOption {
|
||||
# TODO: this option shouldn't be necessary; generate it all directly from `gsettings`
|
||||
type = types.listOf types.package;
|
||||
default = [];
|
||||
description = ''
|
||||
extra packages to link into /etc/dconf
|
||||
dconf values to link into /etc/dconf
|
||||
'';
|
||||
};
|
||||
};
|
||||
@@ -40,7 +52,7 @@ in
|
||||
# but in practice seems unnecessary.
|
||||
# env.GIO_EXTRA_MODULES = "${pkgs.dconf.lib}/lib/gio/modules";
|
||||
|
||||
config.site = [
|
||||
config.site = sitePackages ++ [
|
||||
(pkgs.writeTextFile {
|
||||
name = "dconf-user-profile";
|
||||
destination = "/etc/dconf/profile/user";
|
||||
|
@@ -1,6 +1,4 @@
|
||||
# preferences are saved via dconf; see `dconf dump /`
|
||||
# cache dir is just for weather data (or maybe a http cache)
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
sane.programs.gnome-weather = {
|
||||
buildCost = 1;
|
||||
@@ -16,21 +14,29 @@
|
||||
sandbox.wrapperType = "inplace"; #< /share/org.gnome.Weather/org.gnome.Weather file refers to bins by full path
|
||||
sandbox.whitelistWayland = true;
|
||||
sandbox.net = "clearnet";
|
||||
suggestedPrograms = [ "dconf" ]; #< stores city/location settings
|
||||
|
||||
persist.byStore.plaintext = [
|
||||
".cache/libgweather"
|
||||
".cache/libgweather" # weather data (or maybe a http cache)
|
||||
];
|
||||
|
||||
gsettings."org/gnome/Weather" = with lib.gvariant; {
|
||||
# i have no idea the schema: i just exported this after manually entering a location
|
||||
locations = [
|
||||
(mkVariant
|
||||
(mkTuple [
|
||||
(mkUint32 2)
|
||||
(mkVariant
|
||||
(mkTuple [
|
||||
"Seattle"
|
||||
"KBFI"
|
||||
true
|
||||
[ (mkTuple [ 0.82983133145337307 (-2.134775231953554) ]) ]
|
||||
[ (mkTuple [ 0.83088509144255718 (-2.135097419733472) ]) ]
|
||||
])
|
||||
)
|
||||
])
|
||||
)
|
||||
];
|
||||
};
|
||||
|
||||
sane.programs.dconf.config.site = lib.mkIf config.sane.programs.gnome-weather.enabled [
|
||||
(pkgs.writeTextFile {
|
||||
name = "sane-gnome-weather";
|
||||
destination = "/etc/dconf/db/site.d/10_gnome_weather";
|
||||
text = ''
|
||||
[org/gnome/Weather]
|
||||
locations=[<(uint32 2, <('Seattle', 'KBFI', true, [(0.82983133145337307, -2.134775231953554)], [(0.83088509144255718, -2.135097419733472)])>)>]
|
||||
'';
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
|
@@ -312,27 +312,17 @@ in
|
||||
suggestedPrograms = [
|
||||
"sane-backgrounds"
|
||||
];
|
||||
|
||||
gsettings."org/gnome/desktop/interface" = {
|
||||
inherit (cfg) color-scheme cursor-theme gtk-theme icon-theme;
|
||||
};
|
||||
};
|
||||
|
||||
sane.programs.sane-backgrounds = {
|
||||
sandbox.enable = false; #< no binaries
|
||||
};
|
||||
|
||||
|
||||
environment.pathsToLink = lib.mkIf config.sane.programs.sane-backgrounds.enabled [
|
||||
"/share/backgrounds"
|
||||
];
|
||||
sane.programs.dconf.config.site = lib.mkIf config.sane.programs.sane-theme.enabled [
|
||||
(pkgs.writeTextFile {
|
||||
name = "sane-theme";
|
||||
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}"
|
||||
'';
|
||||
})
|
||||
];
|
||||
}
|
||||
|
@@ -111,6 +111,10 @@ let
|
||||
);
|
||||
pkgSpec = with lib; types.submodule ({ config, name, ... }: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = name;
|
||||
};
|
||||
packageUnwrapped = mkOption {
|
||||
type = types.nullOr types.package;
|
||||
description = ''
|
||||
@@ -165,6 +169,24 @@ let
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
# XXX: even if these `gsettings` and `mime` properties aren't used by this module,
|
||||
# putting them here allows for the visibility by the consumers that do actually use them.
|
||||
gsettings = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
description = ''
|
||||
gsetting config values to provide this program (and the broader system).
|
||||
this is the nix representation of what you'd want `dconf dump /` to show
|
||||
(only, it's not plumbed to dconf but rather the layer above it -- gsettings).
|
||||
'';
|
||||
example = ''
|
||||
{
|
||||
"org/erikreider/swaync" = {
|
||||
dnd-state = true;
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
mime.priority = mkOption {
|
||||
type = types.int;
|
||||
default = 100;
|
||||
|
Reference in New Issue
Block a user