aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--homes/x86_64-linux/c/default.nix9
-rw-r--r--modules/home/desktop/components/gtk/default.nix9
-rw-r--r--modules/home/desktop/default.nix75
-rw-r--r--modules/home/desktop/theme/gruvbox.nix26
-rw-r--r--modules/home/desktop/theme/gruvbox/default.nix40
5 files changed, 100 insertions, 59 deletions
diff --git a/homes/x86_64-linux/c/default.nix b/homes/x86_64-linux/c/default.nix
index 069e549..2115737 100644
--- a/homes/x86_64-linux/c/default.nix
+++ b/homes/x86_64-linux/c/default.nix
@@ -1,8 +1,13 @@
{ config, lib, namespace, ... }:
-with lib; with lib.${namespace}; {
+with lib; with lib.${namespace}; let
+ themes = config.${namespace}.desktop.themes;
+in {
cxl = {
- desktop.background = "shinobu.png";
+ desktop = {
+ background = "shinobu.png";
+ theme = themes."gruvbox";
+ };
suites = {
common.enable = true;
diff --git a/modules/home/desktop/components/gtk/default.nix b/modules/home/desktop/components/gtk/default.nix
index a20cc1f..ccdb031 100644
--- a/modules/home/desktop/components/gtk/default.nix
+++ b/modules/home/desktop/components/gtk/default.nix
@@ -1,7 +1,8 @@
-{ options, config, lib, pkgs, namespace, ... }:
+{ options, config, lib, namespace, ... }:
with lib; with lib.${namespace}; let
cfg = config.${namespace}.desktop.components.gtk;
+ theme = config.${namespace}.desktop.theme;
in {
options.${namespace}.desktop.components.gtk = with types; {
enable = mkEnableOption "gtk";
@@ -11,11 +12,7 @@ in {
gtk = {
enable = true;
- #TODO: dynamic theming
- theme = {
- package = pkgs.gruvbox-gtk-theme;
- name = "Gruvbox-Dark";
- };
+ theme = theme.gtk;
font = {
name = "monospace";
diff --git a/modules/home/desktop/default.nix b/modules/home/desktop/default.nix
index e434c6c..6b2ab79 100644
--- a/modules/home/desktop/default.nix
+++ b/modules/home/desktop/default.nix
@@ -2,29 +2,33 @@
with lib; with lib.${namespace}; let
cfg = config.${namespace}.desktop;
-in {
- options.${namespace}.desktop = with types; {
- enable = mkEnableOption "desktop";
+ themeType = with types; submodule {
+ options = {
+ name = mkOption {
+ type = str;
+ };
- background = mkOption {
- type = enum [
- "lycoris.png"
- "matama.png"
- "mem.png"
- "nonon.png"
- "ryo.png"
- "shinobu.png"
- "skull.png"
- ];
- apply = value: ./bg/${value};
- };
+ gtk = {
+ package = mkOption {
+ type = types.nullOr types.package;
+ default = null;
+ example = literalExpression "pkgs.gnome.gnome-themes-extra";
+ description = ''
+ Package providing the theme. This package will be installed
+ to your profile. If `null` then the theme
+ is assumed to already be available in your profile.
- theme = {
- name = mkOption {
- type = enum [ "gruvbox" ];
- default = "gruvbox";
+ For the theme to apply to GTK 4, this option is mandatory.
+ '';
+ };
+
+ name = mkOption {
+ type = types.str;
+ example = "Adwaita";
+ description = "The name of the theme within the package.";
+ };
};
-
+
colors = let
mkColorOption = name: {
inherit name;
@@ -39,19 +43,40 @@ in {
};
in listToAttrs (map mkColorOption [
"accent"
-
+
"black" "red" "green" "yellow" "blue" "magenta" "cyan" "white"
"brightBlack" "brightRed" "brightGreen" "brightYellow" "brightBlue" "brightMagenta" "brightCyan" "brightWhite"
-
+
"bg" "bg0" "bg1" "bg2" "bg3" "bg4"
"fg" "fg0" "fg1" "fg2" "fg3" "fg4"
-
+
"orange" "brightOrange"
]);
};
};
+in {
+ options.${namespace}.desktop = with types; {
+ enable = mkEnableOption "desktop";
+
+ background = mkOption {
+ type = enum [
+ "lycoris.png"
+ "matama.png"
+ "mem.png"
+ "nonon.png"
+ "ryo.png"
+ "shinobu.png"
+ "skull.png"
+ ];
+ apply = value: ./bg/${value};
+ };
- config = {
- cxl.desktop.theme.colors = import ./theme/${cfg.theme.name}.nix;
+ themes = mkOption {
+ type = attrsOf themeType;
+ };
+
+ theme = mkOption {
+ type = themeType;
+ };
};
}
diff --git a/modules/home/desktop/theme/gruvbox.nix b/modules/home/desktop/theme/gruvbox.nix
deleted file mode 100644
index 0bfb043..0000000
--- a/modules/home/desktop/theme/gruvbox.nix
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- accent = "cc241d";
-
- black = "282828"; brightBlack = "928374";
- red = "cc241d"; brightRed = "fb4934";
- green = "98971a"; brightGreen = "b8bb26";
- yellow = "d79921"; brightYellow = "fabd2f";
- blue = "458588"; brightBlue = "83a598";
- magenta = "b16286"; brightMagenta = "d3869b";
- cyan = "689d6a"; brightCyan = "8ec07c";
- white = "a89984"; brightWhite = "ebdbb2";
-
- bg = "282828";
- bg0 = "282828";
- bg1 = "3c3836";
- bg2 = "504945";
- bg3 = "665c54";
- bg4 = "7c6f64";
-
- fg = "ebdbb2";
- fg0 = "fbf1c7";
- fg1 = "ebdbb2";
- fg2 = "d5c4a1";
- fg3 = "bdae93";
- fg4 = "a89984";
-}
diff --git a/modules/home/desktop/theme/gruvbox/default.nix b/modules/home/desktop/theme/gruvbox/default.nix
new file mode 100644
index 0000000..7b0aa9d
--- /dev/null
+++ b/modules/home/desktop/theme/gruvbox/default.nix
@@ -0,0 +1,40 @@
+{ options, config, lib, pkgs, namespace, ... }:
+
+with lib; with lib.${namespace}; {
+ cxl.desktop.themes."gruvbox" = {
+ #TODO: grab this from attr name somehow
+ name = "gruvbox";
+
+ gtk = {
+ package = pkgs.gruvbox-gtk-theme;
+ name = "Gruvbox-Dark";
+ };
+
+ colors = {
+ accent = "cc241d";
+
+ black = "282828"; brightBlack = "928374";
+ red = "cc241d"; brightRed = "fb4934";
+ green = "98971a"; brightGreen = "b8bb26";
+ yellow = "d79921"; brightYellow = "fabd2f";
+ blue = "458588"; brightBlue = "83a598";
+ magenta = "b16286"; brightMagenta = "d3869b";
+ cyan = "689d6a"; brightCyan = "8ec07c";
+ white = "a89984"; brightWhite = "ebdbb2";
+
+ bg = "282828";
+ bg0 = "282828";
+ bg1 = "3c3836";
+ bg2 = "504945";
+ bg3 = "665c54";
+ bg4 = "7c6f64";
+
+ fg = "ebdbb2";
+ fg0 = "fbf1c7";
+ fg1 = "ebdbb2";
+ fg2 = "d5c4a1";
+ fg3 = "bdae93";
+ fg4 = "a89984";
+ };
+ };
+}