feat(home): iconTheme module

This commit is contained in:
punkfairie 2024-11-15 18:13:45 -08:00
parent 35c4b54705
commit f60f0e1d29
Signed by: punkfairie
GPG key ID: A509E8F77FB9D696

View file

@ -1,24 +1,28 @@
{ lib, config, ... }:
with lib;
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 = types.nullOr types.package;
type = with types; nullOr package;
default = null;
example = literalExpression "pkgs.gnome.adwaita-icon-theme";
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.
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 = types.str;
type = with types; str;
example = "Adwaita";
description = "The name of the icon theme within the package.";
};
@ -29,11 +33,9 @@ in
options = {
home = {
iconTheme = mkOption {
type = types.nullOr iconThemeType;
type = with types; nullOr iconThemeType;
default = null;
description = ''
The icon theme to use.
'';
description = "The icon theme to use.";
};
};
};
@ -42,18 +44,18 @@ in
let
cfg = config.home.iconTheme;
in
{
mkIf (cfg != "null") {
gtk = mkIf config.gtk.enable (mkDefault {
iconTheme = {
name = cfg.name;
package = cfg.package;
inherit (cfg) name;
package = mkIf (cfg.package != "null") cfg.package;
};
});
services.dunst = mkIf config.services.dunst.enable (mkDefault {
iconTheme = {
name = cfg.name;
package = cfg.package;
inherit (cfg) name;
package = mkIf (cfg.package != "null") cfg.package;
};
});
};