marleyos/modules/home/iconTheme/default.nix

62 lines
1.4 KiB
Nix

{ lib, config, ... }:
let
inherit (lib)
types
mkOption
mkIf
mkDefault
;
# https://github.com/nix-community/home-manager/blob/master/modules/misc/gtk.nix
iconThemeType = types.submodule {
options = {
package = mkOption {
type = with types; nullOr package;
default = null;
example = "pkgs.gnome.adwaita-icon-theme";
description = ''
Package providing the icon theme. This package will be installed to
your profile. If `null` then the theme is assumed to already be
available in your profile.
'';
};
name = mkOption {
type = with types; str;
example = "Adwaita";
description = "The name of the icon theme within the package.";
};
};
};
in
{
options = {
home = {
iconTheme = mkOption {
type = with types; nullOr iconThemeType;
default = null;
description = "The icon theme to use.";
};
};
};
config =
let
cfg = config.home.iconTheme;
in
mkIf (cfg != "null") {
gtk = mkIf config.gtk.enable (mkDefault {
iconTheme = {
inherit (cfg) name;
package = mkIf (cfg.package != "null") cfg.package;
};
});
services.dunst = mkIf config.services.dunst.enable (mkDefault {
iconTheme = {
inherit (cfg) name;
package = mkIf (cfg.package != "null") cfg.package;
};
});
};
}