feat(modules): Add iconTheme module

Allows setting iconTheme globally.
This commit is contained in:
punkfairie 2024-11-03 20:13:11 -08:00
parent bfd3d6c289
commit 83f4dbff57
Signed by: punkfairie
GPG key ID: 01823C057725C266
5 changed files with 67 additions and 13 deletions

View file

@ -48,6 +48,7 @@
modules = [
inputs.rose-pine.homeManagerModules.rose-pine
./modules/home/shellAbbrs.nix
./modules/home/iconTheme.nix
./home
];
};

View file

@ -6,6 +6,11 @@
rose-pine.pointerCursor.enable = true;
home.iconTheme = {
package = pkgs.kora-icon-theme;
name = "kora";
};
fonts.fontconfig.defaultFonts.monospace = [ "Maple Mono NF" ];
imports = [

View file

@ -1,13 +1,8 @@
{ pkgs, ... }:
{ ... }:
{
gtk = {
enable = true;
rose-pine.enable = true;
iconTheme = {
package = pkgs.kora-icon-theme;
name = "kora";
};
};
}

View file

@ -1,5 +1,4 @@
{
pkgs,
config,
lib,
...
@ -12,12 +11,6 @@
# drop-in weirdness.
rose-pine.enable = false;
# TODO: Set this globally and import it.
iconTheme = {
package = pkgs.kora-icon-theme;
name = "Kora";
};
settings = lib.mkMerge [
### Rose Pine ###
# TODO: Set this conditionally based on current theme.

View file

@ -0,0 +1,60 @@
{ lib, config, ... }:
with lib;
let
# https://github.com/nix-community/home-manager/blob/master/modules/misc/gtk.nix
iconThemeType = types.submodule {
options = {
package = mkOption {
type = types.nullOr types.package;
default = null;
example = literalExpression "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 = types.str;
example = "Adwaita";
description = "The name of the icon theme within the package.";
};
};
};
in
{
options = {
home = {
iconTheme = mkOption {
type = types.nullOr iconThemeType;
default = null;
description = ''
The icon theme to use.
'';
};
};
};
config =
let
cfg = config.home.iconTheme;
in
{
gtk = mkIf config.gtk.enable (mkDefault {
iconTheme = {
name = cfg.name;
package = cfg.package;
};
});
services.dunst = mkIf config.services.dunst.enable (mkDefault {
iconTheme = {
name = cfg.name;
package = cfg.package;
};
});
};
}