alqueva/hosts/shared/dconf.nix

85 lines
2 KiB
Nix
Raw Normal View History

{
config,
lib,
...
}:
let
cfg = config.alqueva.system.dconf;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types)
str
enum
attrs
listOf
ints
package
;
inherit (lib.modules) mkIf;
in
{
options.alqueva.system.dconf = {
enable = mkEnableOption "configuration with DConf";
luminosity = mkOption {
type = enum [
"dark"
"light"
"default"
];
default = "dark";
description = "The luminosity you want to use for GTK.";
apply = lum: if lum == "default" then lum else "prefer-${lum}";
};
theme = mkOption {
type = str;
description = "The theme you want to use for GTK.";
default = "";
};
icon.theme = mkOption {
type = str;
description = "The icon theme you want to use for GTK.";
default = "";
};
cursor = {
theme = mkOption {
type = str;
description = "The cursor theme you want to use for GTK.";
default = "";
};
size = mkOption {
type = ints.u32;
default = 24;
description = "The cursor size you want to use for GTK.";
apply = size: lib.gvariant.mkUint32 size;
};
};
extraDconfPackages = mkOption {
type = listOf package;
description = "Extra packages to install for DConf.";
default = [ ];
};
extraDconfSettings = mkOption {
type = attrs;
description = "Extra settings you want to apply to DConf.";
default = { };
};
};
config = lib.mkIf cfg.enable {
programs.dconf = {
profiles.user.databases = [
{
settings = {
"org/gnome/desktop/interface" = {
color-scheme = cfg.luminosity;
cursor-size = cfg.cursor.size;
cursor-theme = cfg.cursor.theme;
icon-theme = cfg.icon.theme;
gtk-theme = cfg.theme;
};
} // cfg.extraDconfSettings;
}
];
packages = cfg.extraDconfPackages;
};
};
}