alqueva/hosts/shared/dconf.nix
2025-01-21 16:55:49 +00:00

74 lines
2 KiB
Nix

{
config,
lib,
...
}: let
cfg = config.alqueva.system.dconf;
inherit (lib) types;
in {
options.alqueva.system.dconf = {
enable = lib.mkEnableOption "configuration with DConf";
luminosity = lib.mkOption {
type = types.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 = lib.mkOption {
type = types.str;
description = "The theme you want to use for GTK.";
default = "";
};
icon.theme = lib.mkOption {
type = types.str;
description = "The icon theme you want to use for GTK.";
default = "";
};
cursor = {
theme = lib.mkOption {
type = types.str;
description = "The cursor theme you want to use for GTK.";
default = "";
};
size = lib.mkOption {
type = types.ints.u32;
default = 24;
description = "The cursor size you want to use for GTK.";
apply = size: lib.gvariant.mkUint32 size;
};
};
extraDconfPackages = lib.mkOption {
type = types.listOf types.package;
description = "Extra packages to install for DConf.";
default = [];
};
extraDconfSettings = lib.mkOption {
type = types.attrsOf types.anything;
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;
};
};
}