refactor(modules): rewrite some modules; add dconf

This commit is contained in:
Artur Manuel 2025-01-21 15:45:42 +00:00
commit 7938019d55
15 changed files with 131 additions and 59 deletions

71
hosts/shared/dconf.nix Normal file
View file

@ -0,0 +1,71 @@
{
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 = "dark";
description = "The luminosity you want to use for GTK.";
apply = lum: "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;
};
};
}