mirror of
https://github.com/danth/stylix
synced 2024-11-24 21:23:24 +00:00
stylix: add 'stylix.enable' option (#244)
Add a 'stylix.enable' option to enable or disable all Stylix modules in order to resolve issues similar to [2]. To align with the default 'lib.mkEnableOption' [1] behavior, 'stylix.enable' defaults to 'false'. BREAKING CHANGE: Stylix is disabled by default. To enable it, use: stylix.enable = true; [1]: https://github.com/NixOS/nixpkgs/blob/23.11/lib/options.nix#L91-L105 [2]: https://github.com/danth/stylix/issues/216 Co-authored-by: Daniel Thwaites <danthwaites30@btinternet.com> Co-authored-by: Jalil David Salamé Messina <jalil.salame@gmail.com> Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
parent
ca3247ed8c
commit
7682713f6a
67 changed files with 196 additions and 116 deletions
|
@ -34,6 +34,12 @@ For a visual guide, watch the [*Ricing Linux Has Never Been Easier | NixOS +
|
||||||
Stylix*](https://youtu.be/ljHkWgBaQWU) YouTube video by
|
Stylix*](https://youtu.be/ljHkWgBaQWU) YouTube video by
|
||||||
[Vimjoyer](https://www.youtube.com/@vimjoyer).
|
[Vimjoyer](https://www.youtube.com/@vimjoyer).
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
>
|
||||||
|
> It's now necessary to include `stylix.enable = true` in your configuration
|
||||||
|
> for any other settings to take effect. This is not mentioned in the video
|
||||||
|
> linked above.
|
||||||
|
|
||||||
If you have any questions, you are welcome to
|
If you have any questions, you are welcome to
|
||||||
join our [Matrix room](https://matrix.to/#/#stylix:danth.me),
|
join our [Matrix room](https://matrix.to/#/#stylix:danth.me),
|
||||||
or ask on [GitHub Discussions](https://github.com/danth/stylix/discussions).
|
or ask on [GitHub Discussions](https://github.com/danth/stylix/discussions).
|
||||||
|
|
|
@ -47,6 +47,14 @@ in pkgs.stdenvNoCC.mkDerivation {
|
||||||
cp ${../kde.png} src/kde.png
|
cp ${../kde.png} src/kde.png
|
||||||
cp ${../CONTRIBUTING.md} src/contributing.md
|
cp ${../CONTRIBUTING.md} src/contributing.md
|
||||||
|
|
||||||
|
# mdBook doesn't support this Markdown extension yet
|
||||||
|
substituteInPlace **/*.md \
|
||||||
|
--replace-quiet '> [!NOTE]' '> **Note**' \
|
||||||
|
--replace-quiet '> [!TIP]' '> **Tip**' \
|
||||||
|
--replace-quiet '> [!IMPORTANT]' '> **Important**' \
|
||||||
|
--replace-quiet '> [!WARNING]' '> **Warning**' \
|
||||||
|
--replace-quiet '> [!CAUTION]' '> **Caution**'
|
||||||
|
|
||||||
# The "declared by" links point to a file which only exists when the docs
|
# The "declared by" links point to a file which only exists when the docs
|
||||||
# are built locally. This removes the links.
|
# are built locally. This removes the links.
|
||||||
sed '/*Declared by:*/,/^$/d' <${nixos.optionsCommonMark} >>src/options/nixos.md
|
sed '/*Declared by:*/,/^$/d' <${nixos.optionsCommonMark} >>src/options/nixos.md
|
||||||
|
|
|
@ -1,5 +1,21 @@
|
||||||
# Configuration
|
# Configuration
|
||||||
|
|
||||||
|
## Enable
|
||||||
|
|
||||||
|
To enable the Stylix module, declare:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
stylix.enable = true;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
>
|
||||||
|
> The global enable option was recently added, so you may come across old
|
||||||
|
> examples which don't include it. No other settings will take effect unless
|
||||||
|
> `stylix.enable` is set to `true`.
|
||||||
|
|
||||||
## Wallpaper
|
## Wallpaper
|
||||||
|
|
||||||
To start theming, you need to set a wallpaper image.
|
To start theming, you need to set a wallpaper image.
|
||||||
|
|
|
@ -119,7 +119,10 @@ let
|
||||||
in {
|
in {
|
||||||
imports = [ (import stylix).homeManagerModules.stylix ];
|
imports = [ (import stylix).homeManagerModules.stylix ];
|
||||||
|
|
||||||
stylix.image = ./wallpaper.jpg;
|
stylix = {
|
||||||
|
enable = true;
|
||||||
|
image = ./wallpaper.jpg;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -37,6 +37,7 @@ All modules should have an enable option created using `mkEnableTarget`.
|
||||||
This is similar to
|
This is similar to
|
||||||
[`mkEnableOption`](https://nix-community.github.io/docnix/reference/lib/options/lib-options-mkenableoption/)
|
[`mkEnableOption`](https://nix-community.github.io/docnix/reference/lib/options/lib-options-mkenableoption/)
|
||||||
from the standard library, however it integrates with
|
from the standard library, however it integrates with
|
||||||
|
[`stylix.enable`](./options/nixos.md#stylixenable) and
|
||||||
[`stylix.autoEnable`](./options/nixos.md#stylixautoenable)
|
[`stylix.autoEnable`](./options/nixos.md#stylixautoenable)
|
||||||
and generates more specific documentation.
|
and generates more specific documentation.
|
||||||
|
|
||||||
|
@ -46,16 +47,29 @@ A general format for modules is shown below.
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
stylix.targets.«name».enable = config.lib.stylix.mkEnableTarget "«human readable name»";
|
options.stylix.targets.«name».enable =
|
||||||
|
config.lib.stylix.mkEnableTarget "«human readable name»" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.«name».enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.«name».enable) {
|
||||||
|
programs.«name».backgroundColor = config.lib.stylix.colors.base00;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The human readable name must fit into the following sentence:
|
The human readable name will be inserted into the following sentence:
|
||||||
|
|
||||||
> Whether to style «human readable name».
|
> Whether to enable theming for «human readable name».
|
||||||
|
|
||||||
|
If your module will touch options outside of `programs.«name»` or `services.«name»`,
|
||||||
|
it should include an additional condition in `mkIf` to prevent any effects
|
||||||
|
when the target is not installed.
|
||||||
|
|
||||||
|
The boolean value after `mkEnableTarget` should be changed to `false` if
|
||||||
|
one of the following applies:
|
||||||
|
|
||||||
|
- The module requires further manual setup to work correctly.
|
||||||
|
- There is no reliable way to detect whether the target is installed, *and*
|
||||||
|
enabling it unconditionally would cause problems.
|
||||||
|
|
||||||
## How to apply colors
|
## How to apply colors
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ in
|
||||||
{
|
{
|
||||||
options.stylix.targets.alacritty.enable = config.lib.stylix.mkEnableTarget "Alacritty" true;
|
options.stylix.targets.alacritty.enable = config.lib.stylix.mkEnableTarget "Alacritty" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.alacritty.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.alacritty.enable) {
|
||||||
programs.alacritty.settings = {
|
programs.alacritty.settings = {
|
||||||
font = with config.stylix.fonts; {
|
font = with config.stylix.fonts; {
|
||||||
normal = {
|
normal = {
|
||||||
|
|
|
@ -10,7 +10,7 @@ in
|
||||||
config.lib.stylix.mkEnableTarget "Avizo" true;
|
config.lib.stylix.mkEnableTarget "Avizo" true;
|
||||||
|
|
||||||
# Referenced https://github.com/stacyharper/base16-mako
|
# Referenced https://github.com/stacyharper/base16-mako
|
||||||
config = lib.optionalAttrs (options.services ? avizo) (lib.mkIf config.stylix.targets.avizo.enable {
|
config = lib.optionalAttrs (options.services ? avizo) (lib.mkIf (config.stylix.enable && config.stylix.targets.avizo.enable) {
|
||||||
services.avizo = {
|
services.avizo = {
|
||||||
settings = {
|
settings = {
|
||||||
default = {
|
default = {
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
options.stylix.targets.bat.enable =
|
options.stylix.targets.bat.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Bat" config.programs.bat.enable;
|
config.lib.stylix.mkEnableTarget "Bat" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.bat.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.bat.enable) {
|
||||||
programs.bat = {
|
programs.bat = {
|
||||||
# This theme is reused for yazi. Changes to the template
|
# This theme is reused for yazi. Changes to the template
|
||||||
# will need to be applied to modules/yazi/hm.nix
|
# will need to be applied to modules/yazi/hm.nix
|
||||||
|
|
|
@ -25,7 +25,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.bemenu.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.bemenu.enable) {
|
||||||
programs.bemenu.settings = with config.stylix.targets.bemenu; {
|
programs.bemenu.settings = with config.stylix.targets.bemenu; {
|
||||||
tb = "${base01}${bemenuOpacity}"; # Title bg
|
tb = "${base01}${bemenuOpacity}"; # Title bg
|
||||||
nb = "${base01}${bemenuOpacity}"; # Normal bg
|
nb = "${base01}${bemenuOpacity}"; # Normal bg
|
||||||
|
|
|
@ -6,7 +6,7 @@ in {
|
||||||
options.stylix.targets.bspwm.enable =
|
options.stylix.targets.bspwm.enable =
|
||||||
config.lib.stylix.mkEnableTarget "bspwm" true;
|
config.lib.stylix.mkEnableTarget "bspwm" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.bspwm.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.bspwm.enable) {
|
||||||
xsession.windowManager.bspwm.settings = {
|
xsession.windowManager.bspwm.settings = {
|
||||||
normal_border_color = colors.base03;
|
normal_border_color = colors.base03;
|
||||||
active_border_color = colors.base0C;
|
active_border_color = colors.base0C;
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
let
|
let
|
||||||
colors = config.lib.stylix.colors.withHashtag;
|
colors = config.lib.stylix.colors.withHashtag;
|
||||||
in {
|
in {
|
||||||
options.stylix.targets.btop.enable = config.lib.stylix.mkEnableTarget "btop" config.programs.btop.enable;
|
options.stylix.targets.btop.enable = config.lib.stylix.mkEnableTarget "btop" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.btop.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.btop.enable && config.programs.btop.enable) {
|
||||||
|
|
||||||
programs.btop.settings = {
|
programs.btop.settings = {
|
||||||
color_theme = "stylix";
|
color_theme = "stylix";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
options.stylix.targets.chromium.enable =
|
options.stylix.targets.chromium.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Chromium, Google Chrome and Brave" true;
|
config.lib.stylix.mkEnableTarget "Chromium, Google Chrome and Brave" true;
|
||||||
|
|
||||||
config.programs.chromium = lib.mkIf config.stylix.targets.chromium.enable {
|
config.programs.chromium = lib.mkIf (config.stylix.enable && config.stylix.targets.chromium.enable) {
|
||||||
# This enables policies without installing the browser. Policies take up a
|
# This enables policies without installing the browser. Policies take up a
|
||||||
# negligible amount of space, so it's reasonable to have this always on.
|
# negligible amount of space, so it's reasonable to have this always on.
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -6,7 +6,7 @@ with config.lib.stylix.colors;
|
||||||
options.stylix.targets.console.enable =
|
options.stylix.targets.console.enable =
|
||||||
config.lib.stylix.mkEnableTarget "the Linux kernel console" true;
|
config.lib.stylix.mkEnableTarget "the Linux kernel console" true;
|
||||||
|
|
||||||
config.console.colors = lib.mkIf config.stylix.targets.console.enable [
|
config.console.colors = lib.mkIf (config.stylix.enable && config.stylix.targets.console.enable) [
|
||||||
base00-hex
|
base00-hex
|
||||||
red
|
red
|
||||||
green
|
green
|
||||||
|
|
|
@ -8,7 +8,7 @@ in {
|
||||||
options.stylix.targets.dunst.enable =
|
options.stylix.targets.dunst.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Dunst" true;
|
config.lib.stylix.mkEnableTarget "Dunst" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.dunst.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.dunst.enable) {
|
||||||
services.dunst.settings = {
|
services.dunst.settings = {
|
||||||
global = {
|
global = {
|
||||||
separator_color = base02;
|
separator_color = base02;
|
||||||
|
|
|
@ -8,9 +8,9 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.stylix.targets.emacs.enable =
|
options.stylix.targets.emacs.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Emacs" config.programs.emacs.enable;
|
config.lib.stylix.mkEnableTarget "Emacs" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.emacs.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.emacs.enable) {
|
||||||
programs.emacs = {
|
programs.emacs = {
|
||||||
extraPackages = epkgs:
|
extraPackages = epkgs:
|
||||||
[
|
[
|
||||||
|
|
|
@ -4,13 +4,20 @@
|
||||||
options.stylix.targets.feh.enable =
|
options.stylix.targets.feh.enable =
|
||||||
config.lib.stylix.mkEnableTarget
|
config.lib.stylix.mkEnableTarget
|
||||||
"the desktop background using Feh"
|
"the desktop background using Feh"
|
||||||
(with config.xsession.windowManager; bspwm.enable
|
true;
|
||||||
|| herbstluftwm.enable
|
|
||||||
|| i3.enable
|
|
||||||
|| spectrwm.enable
|
|
||||||
|| xmonad.enable);
|
|
||||||
|
|
||||||
config.xsession.initExtra =
|
config.xsession.initExtra =
|
||||||
lib.mkIf config.stylix.targets.feh.enable
|
lib.mkIf (
|
||||||
|
config.stylix.enable
|
||||||
|
&& config.stylix.targets.feh.enable
|
||||||
|
&& (
|
||||||
|
with config.xsession.windowManager;
|
||||||
|
bspwm.enable
|
||||||
|
|| herbstluftwm.enable
|
||||||
|
|| i3.enable
|
||||||
|
|| spectrwm.enable
|
||||||
|
|| xmonad.enable
|
||||||
|
)
|
||||||
|
)
|
||||||
"${pkgs.feh}/bin/feh --no-fehbg --bg-scale ${config.stylix.image}";
|
"${pkgs.feh}/bin/feh --no-fehbg --bg-scale ${config.stylix.image}";
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,17 @@
|
||||||
options.stylix.targets.feh.enable =
|
options.stylix.targets.feh.enable =
|
||||||
config.lib.stylix.mkEnableTarget
|
config.lib.stylix.mkEnableTarget
|
||||||
"the desktop background using Feh"
|
"the desktop background using Feh"
|
||||||
(with config.services.xserver.windowManager; xmonad.enable || i3.enable);
|
true;
|
||||||
|
|
||||||
config.services.xserver.displayManager.sessionCommands =
|
config.services.xserver.displayManager.sessionCommands =
|
||||||
lib.mkIf config.stylix.targets.feh.enable
|
lib.mkIf (
|
||||||
|
config.stylix.enable
|
||||||
|
&& config.stylix.targets.feh.enable
|
||||||
|
&& (
|
||||||
|
with config.services.xserver.windowManager;
|
||||||
|
xmonad.enable
|
||||||
|
|| i3.enable
|
||||||
|
)
|
||||||
|
)
|
||||||
"${pkgs.feh}/bin/feh --no-fehbg --bg-scale ${config.stylix.image}";
|
"${pkgs.feh}/bin/feh --no-fehbg --bg-scale ${config.stylix.image}";
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ let
|
||||||
in {
|
in {
|
||||||
options.stylix.targets.firefox = {
|
options.stylix.targets.firefox = {
|
||||||
enable =
|
enable =
|
||||||
config.lib.stylix.mkEnableTarget "Firefox" config.programs.firefox.enable;
|
config.lib.stylix.mkEnableTarget "Firefox" true;
|
||||||
|
|
||||||
profileNames = lib.mkOption {
|
profileNames = lib.mkOption {
|
||||||
description = "The Firefox profile names to apply styling on.";
|
description = "The Firefox profile names to apply styling on.";
|
||||||
|
@ -22,7 +22,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.firefox.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.firefox.enable) {
|
||||||
programs.firefox.profiles = lib.listToAttrs
|
programs.firefox.profiles = lib.listToAttrs
|
||||||
(map makeProfileSettingsPair config.stylix.targets.firefox.profileNames);
|
(map makeProfileSettingsPair config.stylix.targets.firefox.profileNames);
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
options.stylix.targets.fish.enable =
|
options.stylix.targets.fish.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Fish" true;
|
config.lib.stylix.mkEnableTarget "Fish" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.fish.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.fish.enable) {
|
||||||
programs.fish.interactiveShellInit = import ./prompt.nix { inherit pkgs config; };
|
programs.fish.interactiveShellInit = import ./prompt.nix { inherit pkgs config; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
options.stylix.targets.fish.enable =
|
options.stylix.targets.fish.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Fish" true;
|
config.lib.stylix.mkEnableTarget "Fish" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.fish.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.fish.enable) {
|
||||||
programs.fish.promptInit = import ./prompt.nix { inherit pkgs config; };
|
programs.fish.promptInit = import ./prompt.nix { inherit pkgs config; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,10 @@ let
|
||||||
|
|
||||||
in {
|
in {
|
||||||
options.stylix.targets.fuzzel.enable =
|
options.stylix.targets.fuzzel.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Fuzzel" config.programs.fuzzel.enable;
|
config.lib.stylix.mkEnableTarget "Fuzzel" true;
|
||||||
|
|
||||||
config.programs.fuzzel.settings =
|
config.programs.fuzzel.settings =
|
||||||
lib.mkIf config.stylix.targets.fuzzel.enable {
|
lib.mkIf (config.stylix.enable && config.stylix.targets.fuzzel.enable) {
|
||||||
colors = {
|
colors = {
|
||||||
background = "${base00-hex}${opacity}";
|
background = "${base00-hex}${opacity}";
|
||||||
text = "${base05-hex}ff";
|
text = "${base05-hex}ff";
|
||||||
|
|
|
@ -20,10 +20,10 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.stylix.targets.fzf = {
|
options.stylix.targets.fzf = {
|
||||||
enable = config.lib.stylix.mkEnableTarget "Fzf" config.programs.fzf.enable;
|
enable = config.lib.stylix.mkEnableTarget "Fzf" true;
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.fzf.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.fzf.enable) {
|
||||||
programs.fzf.defaultOptions = lib.mkAfter [ "--color=${colorConfig}" ];
|
programs.fzf.defaultOptions = lib.mkAfter [ "--color=${colorConfig}" ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ in {
|
||||||
options.stylix.targets.gedit.enable =
|
options.stylix.targets.gedit.enable =
|
||||||
config.lib.stylix.mkEnableTarget "GEdit" true;
|
config.lib.stylix.mkEnableTarget "GEdit" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.gedit.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.gedit.enable) {
|
||||||
xdg.dataFile = {
|
xdg.dataFile = {
|
||||||
"gedit/styles/stylix.xml".source = style;
|
"gedit/styles/stylix.xml".source = style;
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,7 @@ in
|
||||||
options.stylix.targets.gitui.enable =
|
options.stylix.targets.gitui.enable =
|
||||||
config.lib.stylix.mkEnableTarget "GitUI" true;
|
config.lib.stylix.mkEnableTarget "GitUI" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.gitui.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.gitui.enable) {
|
||||||
programs.gitui.theme = ''
|
programs.gitui.theme = ''
|
||||||
(
|
(
|
||||||
selected_tab: Some(Reset),
|
selected_tab: Some(Reset),
|
||||||
|
|
|
@ -6,7 +6,7 @@ with lib;
|
||||||
options.stylix.targets.gnome.enable =
|
options.stylix.targets.gnome.enable =
|
||||||
config.lib.stylix.mkEnableTarget "GNOME" true;
|
config.lib.stylix.mkEnableTarget "GNOME" true;
|
||||||
|
|
||||||
config = mkIf config.stylix.targets.gnome.enable {
|
config = mkIf (config.stylix.enable && config.stylix.targets.gnome.enable) {
|
||||||
dconf.settings = {
|
dconf.settings = {
|
||||||
"org/gnome/desktop/background" = {
|
"org/gnome/desktop/background" = {
|
||||||
color-shading-type = "solid";
|
color-shading-type = "solid";
|
||||||
|
|
|
@ -5,11 +5,13 @@ let
|
||||||
|
|
||||||
in {
|
in {
|
||||||
options.stylix.targets.gnome.enable =
|
options.stylix.targets.gnome.enable =
|
||||||
config.lib.stylix.mkEnableTarget
|
config.lib.stylix.mkEnableTarget "GNOME and GDM" true;
|
||||||
"GNOME and GDM"
|
|
||||||
config.services.xserver.desktopManager.gnome.enable;
|
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.gnome.enable {
|
config = lib.mkIf (
|
||||||
|
config.stylix.enable
|
||||||
|
&& config.stylix.targets.gnome.enable
|
||||||
|
&& config.services.xserver.desktopManager.gnome.enable
|
||||||
|
) {
|
||||||
# As Stylix is controlling the wallpaper, there is no need for this
|
# As Stylix is controlling the wallpaper, there is no need for this
|
||||||
# pack of default wallpapers to be installed.
|
# pack of default wallpapers to be installed.
|
||||||
# If you want to use one, you can set stylix.image to something like
|
# If you want to use one, you can set stylix.image to something like
|
||||||
|
|
|
@ -34,7 +34,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config.boot.loader.grub = lib.mkIf config.stylix.targets.grub.enable {
|
config.boot.loader.grub = lib.mkIf (config.stylix.enable && config.stylix.targets.grub.enable) {
|
||||||
backgroundColor = base00;
|
backgroundColor = base00;
|
||||||
# Need to override the NixOS splash, this will match the background
|
# Need to override the NixOS splash, this will match the background
|
||||||
splashImage = pixel "base00";
|
splashImage = pixel "base00";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
options.stylix.targets.gtk.enable =
|
options.stylix.targets.gtk.enable =
|
||||||
config.lib.stylix.mkEnableTarget "all GTK3, GTK4 and Libadwaita apps" true;
|
config.lib.stylix.mkEnableTarget "all GTK3, GTK4 and Libadwaita apps" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.gtk.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.gtk.enable) {
|
||||||
# Required for Home Manager's GTK settings to work
|
# Required for Home Manager's GTK settings to work
|
||||||
programs.dconf.enable = true;
|
programs.dconf.enable = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,9 +14,9 @@ let
|
||||||
|
|
||||||
in {
|
in {
|
||||||
options.stylix.targets.helix.enable =
|
options.stylix.targets.helix.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Helix" config.programs.helix.enable;
|
config.lib.stylix.mkEnableTarget "Helix" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.helix.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.helix.enable && config.programs.helix.enable) {
|
||||||
programs.helix.settings.theme = "stylix";
|
programs.helix.settings.theme = "stylix";
|
||||||
|
|
||||||
xdg.configFile."helix/themes/stylix.toml".source =
|
xdg.configFile."helix/themes/stylix.toml".source =
|
||||||
|
|
|
@ -25,5 +25,5 @@ in {
|
||||||
config.lib.stylix.mkEnableTarget "Hyprland" true;
|
config.lib.stylix.mkEnableTarget "Hyprland" true;
|
||||||
|
|
||||||
config.wayland.windowManager.hyprland.settings =
|
config.wayland.windowManager.hyprland.settings =
|
||||||
lib.mkIf config.stylix.targets.hyprland.enable settings;
|
lib.mkIf (config.stylix.enable && config.stylix.targets.hyprland.enable) settings;
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,9 +222,9 @@ let
|
||||||
|
|
||||||
in {
|
in {
|
||||||
options.stylix.targets.kde.enable =
|
options.stylix.targets.kde.enable =
|
||||||
config.lib.stylix.mkEnableTarget "KDE" pkgs.stdenv.hostPlatform.isLinux;
|
config.lib.stylix.mkEnableTarget "KDE" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.kde.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.kde.enable && pkgs.stdenv.hostPlatform.isLinux) {
|
||||||
home.packages = [ themePackage ];
|
home.packages = [ themePackage ];
|
||||||
xdg.systemDirs.config = [ "${configPackage}" ];
|
xdg.systemDirs.config = [ "${configPackage}" ];
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
options.stylix.targets.kmscon.enable =
|
options.stylix.targets.kmscon.enable =
|
||||||
config.lib.stylix.mkEnableTarget "the kmscon virtual console" true;
|
config.lib.stylix.mkEnableTarget "the kmscon virtual console" true;
|
||||||
|
|
||||||
config.services.kmscon = lib.mkIf config.stylix.targets.kmscon.enable {
|
config.services.kmscon = lib.mkIf (config.stylix.enable && config.stylix.targets.kmscon.enable) {
|
||||||
fonts = [config.stylix.fonts.monospace];
|
fonts = [config.stylix.fonts.monospace];
|
||||||
extraConfig =
|
extraConfig =
|
||||||
let
|
let
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
}: let
|
}: let
|
||||||
colors = config.lib.stylix.colors.withHashtag;
|
colors = config.lib.stylix.colors.withHashtag;
|
||||||
in {
|
in {
|
||||||
options.stylix.targets.lazygit.enable = config.lib.stylix.mkEnableTarget "lazygit" config.programs.lazygit.enable;
|
options.stylix.targets.lazygit.enable = config.lib.stylix.mkEnableTarget "lazygit" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.lazygit.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.lazygit.enable) {
|
||||||
programs.lazygit.settings.gui.theme = {
|
programs.lazygit.settings.gui.theme = {
|
||||||
activeBorderColor = [
|
activeBorderColor = [
|
||||||
colors.base07
|
colors.base07
|
||||||
|
|
|
@ -5,5 +5,5 @@
|
||||||
config.lib.stylix.mkEnableTarget "LightDM" true;
|
config.lib.stylix.mkEnableTarget "LightDM" true;
|
||||||
|
|
||||||
config.services.xserver.displayManager.lightdm.background =
|
config.services.xserver.displayManager.lightdm.background =
|
||||||
lib.mkIf config.stylix.targets.lightdm.enable config.stylix.image;
|
lib.mkIf (config.stylix.enable && config.stylix.targets.lightdm.enable) config.stylix.image;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ in {
|
||||||
config.lib.stylix.mkEnableTarget "Mako" true;
|
config.lib.stylix.mkEnableTarget "Mako" true;
|
||||||
|
|
||||||
# Referenced https://github.com/stacyharper/base16-mako
|
# Referenced https://github.com/stacyharper/base16-mako
|
||||||
config = lib.optionalAttrs (options.services ? mako) (lib.mkIf config.stylix.targets.mako.enable {
|
config = lib.optionalAttrs (options.services ? mako) (lib.mkIf (config.stylix.enable && config.stylix.targets.mako.enable) {
|
||||||
services.mako = {
|
services.mako = {
|
||||||
backgroundColor = base00 + makoOpacity;
|
backgroundColor = base00 + makoOpacity;
|
||||||
borderColor = base0D;
|
borderColor = base0D;
|
||||||
|
|
|
@ -5,9 +5,9 @@ let
|
||||||
colors = config.lib.stylix.colors;
|
colors = config.lib.stylix.colors;
|
||||||
opacity = config.stylix.opacity;
|
opacity = config.stylix.opacity;
|
||||||
in {
|
in {
|
||||||
options.stylix.targets.mangohud.enable = config.lib.stylix.mkEnableTarget "mangohud" config.programs.mangohud.enable;
|
options.stylix.targets.mangohud.enable = config.lib.stylix.mkEnableTarget "mangohud" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.mangohud.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.mangohud.enable) {
|
||||||
programs.mangohud.settings = with colors; {
|
programs.mangohud.settings = with colors; {
|
||||||
font_size = fonts.sizes.applications;
|
font_size = fonts.sizes.applications;
|
||||||
font_size_text = fonts.sizes.applications;
|
font_size_text = fonts.sizes.applications;
|
||||||
|
|
|
@ -6,7 +6,7 @@ with config.lib.stylix.colors;
|
||||||
options.stylix.targets.nixos-icons.enable =
|
options.stylix.targets.nixos-icons.enable =
|
||||||
config.lib.stylix.mkEnableTarget "the NixOS logo" true;
|
config.lib.stylix.mkEnableTarget "the NixOS logo" true;
|
||||||
|
|
||||||
config.nixpkgs.overlays = lib.mkIf config.stylix.targets.nixos-icons.enable [(self: super: {
|
config.nixpkgs.overlays = lib.mkIf (config.stylix.enable && config.stylix.targets.nixos-icons.enable) [(self: super: {
|
||||||
nixos-icons = super.nixos-icons.overrideAttrs (oldAttrs: {
|
nixos-icons = super.nixos-icons.overrideAttrs (oldAttrs: {
|
||||||
src = pkgs.applyPatches {
|
src = pkgs.applyPatches {
|
||||||
src = oldAttrs.src;
|
src = oldAttrs.src;
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
}: {
|
}: {
|
||||||
options.stylix.targets.nixvim = {
|
options.stylix.targets.nixvim = {
|
||||||
enable =
|
enable =
|
||||||
config.lib.stylix.mkEnableTarget "nixvim" (config.programs ? nixvim);
|
config.lib.stylix.mkEnableTarget "nixvim" true;
|
||||||
transparent_bg = {
|
transparent_bg = {
|
||||||
main = lib.mkEnableOption "background transparency for the main NeoVim window";
|
main = lib.mkEnableOption "background transparency for the main NeoVim window";
|
||||||
sign_column = lib.mkEnableOption "background transparency for the NeoVim sign column";
|
sign_column = lib.mkEnableOption "background transparency for the NeoVim sign column";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf ((config.programs ? nixvim) && config.stylix.targets.nixvim.enable) (
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.nixvim.enable && (config.programs ? nixvim)) (
|
||||||
lib.optionalAttrs (builtins.hasAttr "nixvim" options.programs) {
|
lib.optionalAttrs (builtins.hasAttr "nixvim" options.programs) {
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
colorschemes.base16 = {
|
colorschemes.base16 = {
|
||||||
|
|
|
@ -4,10 +4,10 @@ with config.lib.stylix.colors.withHashtag;
|
||||||
|
|
||||||
{
|
{
|
||||||
options.stylix.targets.nushell.enable =
|
options.stylix.targets.nushell.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Nushell" config.programs.nushell.enable;
|
config.lib.stylix.mkEnableTarget "Nushell" true;
|
||||||
|
|
||||||
# Adapted from https://www.nushell.sh/book/coloring_and_theming.html#theming
|
# Adapted from https://www.nushell.sh/book/coloring_and_theming.html#theming
|
||||||
config.programs.nushell.extraConfig = lib.mkIf config.stylix.targets.nushell.enable ''
|
config.programs.nushell.extraConfig = lib.mkIf (config.stylix.enable && config.stylix.targets.nushell.enable) ''
|
||||||
$env.config.color_config = {
|
$env.config.color_config = {
|
||||||
seperator: "${base03}"
|
seperator: "${base03}"
|
||||||
leading_trailing_space_bg: "${base04}"
|
leading_trailing_space_bg: "${base04}"
|
||||||
|
|
|
@ -21,7 +21,7 @@ in {
|
||||||
options.stylix.targets.qutebrowser.enable =
|
options.stylix.targets.qutebrowser.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Qutebrowser" true;
|
config.lib.stylix.mkEnableTarget "Qutebrowser" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.qutebrowser.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.qutebrowser.enable) {
|
||||||
programs.qutebrowser.settings = {
|
programs.qutebrowser.settings = {
|
||||||
colors = {
|
colors = {
|
||||||
completion = {
|
completion = {
|
||||||
|
|
|
@ -20,7 +20,7 @@ in
|
||||||
options.stylix.targets.rofi.enable =
|
options.stylix.targets.rofi.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Rofi" true;
|
config.lib.stylix.mkEnableTarget "Rofi" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.rofi.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.rofi.enable) {
|
||||||
programs.rofi = {
|
programs.rofi = {
|
||||||
font = "${monospace.name} ${toString sizes.popups}";
|
font = "${monospace.name} ${toString sizes.popups}";
|
||||||
theme = {
|
theme = {
|
||||||
|
|
|
@ -18,7 +18,7 @@ in {
|
||||||
config.lib.stylix.mkEnableTarget "Sway" true;
|
config.lib.stylix.mkEnableTarget "Sway" true;
|
||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
(lib.mkIf config.stylix.targets.sway.enable {
|
(lib.mkIf (config.stylix.enable && config.stylix.targets.sway.enable) {
|
||||||
wayland.windowManager.sway.config = {
|
wayland.windowManager.sway.config = {
|
||||||
inherit fonts;
|
inherit fonts;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ let
|
||||||
|
|
||||||
in {
|
in {
|
||||||
options.stylix.targets.swaylock = {
|
options.stylix.targets.swaylock = {
|
||||||
enable = config.lib.stylix.mkEnableTarget "Swaylock" pkgs.stdenv.hostPlatform.isLinux;
|
enable = config.lib.stylix.mkEnableTarget "Swaylock" true;
|
||||||
useImage = lib.mkOption {
|
useImage = lib.mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
Whether to use your wallpaper image for the Swaylock background.
|
Whether to use your wallpaper image for the Swaylock background.
|
||||||
|
@ -23,7 +23,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.swaylock.enable
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.swaylock.enable && pkgs.stdenv.hostPlatform.isLinux)
|
||||||
# See https://github.com/danth/stylix/issues/8#issuecomment-1194484544
|
# See https://github.com/danth/stylix/issues/8#issuecomment-1194484544
|
||||||
# This check can be removed when programs.swaylock is in a stable release
|
# This check can be removed when programs.swaylock is in a stable release
|
||||||
(lib.optionalAttrs (options.programs ? swaylock) {
|
(lib.optionalAttrs (options.programs ? swaylock) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ in {
|
||||||
options.stylix.targets.sxiv.enable =
|
options.stylix.targets.sxiv.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Sxiv" true;
|
config.lib.stylix.mkEnableTarget "Sxiv" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.sxiv.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.sxiv.enable) {
|
||||||
xresources = {
|
xresources = {
|
||||||
properties = {
|
properties = {
|
||||||
"Sxiv.foreground" = "#${colors.base01}";
|
"Sxiv.foreground" = "#${colors.base01}";
|
||||||
|
|
|
@ -7,9 +7,9 @@ let
|
||||||
|
|
||||||
in {
|
in {
|
||||||
options.stylix.targets.tmux.enable =
|
options.stylix.targets.tmux.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Tmux" config.programs.tmux.enable;
|
config.lib.stylix.mkEnableTarget "Tmux" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.tmux.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.tmux.enable) {
|
||||||
programs.tmux.extraConfig = ''
|
programs.tmux.extraConfig = ''
|
||||||
source-file ${theme}
|
source-file ${theme}
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -7,7 +7,7 @@ with config.lib.stylix.colors.withHashtag; {
|
||||||
options.stylix.targets.tofi.enable =
|
options.stylix.targets.tofi.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Tofi" true;
|
config.lib.stylix.mkEnableTarget "Tofi" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.tofi.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.tofi.enable) {
|
||||||
programs.tofi.settings =
|
programs.tofi.settings =
|
||||||
let
|
let
|
||||||
opacity = lib.toHexString ((((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100));
|
opacity = lib.toHexString ((((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100));
|
||||||
|
|
|
@ -8,7 +8,7 @@ in
|
||||||
{
|
{
|
||||||
options.stylix.targets.vesktop.enable = config.lib.stylix.mkEnableTarget "Vesktop" true;
|
options.stylix.targets.vesktop.enable = config.lib.stylix.mkEnableTarget "Vesktop" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.vesktop.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.vesktop.enable) {
|
||||||
home.file."${config.xdg.configHome}/vesktop/themes/stylix.theme.css" = {
|
home.file."${config.xdg.configHome}/vesktop/themes/stylix.theme.css" = {
|
||||||
source = themeFile;
|
source = themeFile;
|
||||||
};
|
};
|
||||||
|
|
|
@ -55,7 +55,7 @@ in {
|
||||||
options.stylix.targets.vim.enable =
|
options.stylix.targets.vim.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Vim and/or Neovim" true;
|
config.lib.stylix.mkEnableTarget "Vim and/or Neovim" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.vim.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.vim.enable) {
|
||||||
programs.vim = vimOptions;
|
programs.vim = vimOptions;
|
||||||
programs.neovim = vimOptions;
|
programs.neovim = vimOptions;
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,7 +22,7 @@ in {
|
||||||
options.stylix.targets.vscode.enable =
|
options.stylix.targets.vscode.enable =
|
||||||
config.lib.stylix.mkEnableTarget "VSCode" true;
|
config.lib.stylix.mkEnableTarget "VSCode" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.vscode.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.vscode.enable) {
|
||||||
programs.vscode = {
|
programs.vscode = {
|
||||||
extensions = [ themeExtension ];
|
extensions = [ themeExtension ];
|
||||||
userSettings = {
|
userSettings = {
|
||||||
|
|
|
@ -32,7 +32,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.waybar.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.waybar.enable) {
|
||||||
programs.waybar.style = ''
|
programs.waybar.style = ''
|
||||||
@define-color base00 ${base00}; @define-color base01 ${base01}; @define-color base02 ${base02}; @define-color base03 ${base03};
|
@define-color base00 ${base00}; @define-color base01 ${base01}; @define-color base02 ${base02}; @define-color base03 ${base03};
|
||||||
@define-color base04 ${base04}; @define-color base05 ${base05}; @define-color base06 ${base06}; @define-color base07 ${base07};
|
@define-color base04 ${base04}; @define-color base05 ${base05}; @define-color base06 ${base06}; @define-color base07 ${base07};
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
let colors = config.lib.stylix.colors.withHashtag;
|
let colors = config.lib.stylix.colors.withHashtag;
|
||||||
in {
|
in {
|
||||||
options.stylix.targets.wezterm.enable =
|
options.stylix.targets.wezterm.enable =
|
||||||
config.lib.stylix.mkEnableTarget "wezterm" config.programs.wezterm.enable;
|
config.lib.stylix.mkEnableTarget "wezterm" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.wezterm.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.wezterm.enable && config.programs.wezterm.enable) {
|
||||||
|
|
||||||
programs.wezterm.colorSchemes.stylix = with colors; {
|
programs.wezterm.colorSchemes.stylix = with colors; {
|
||||||
ansi = [ base00 base08 base0B base0A base0D base0E base0C base05 ];
|
ansi = [ base00 base08 base0B base0A base0D base0E base0C base05 ];
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{
|
{
|
||||||
options.stylix.targets.wpaperd.enable = config.lib.stylix.mkEnableTarget "wpaperd" true;
|
options.stylix.targets.wpaperd.enable = config.lib.stylix.mkEnableTarget "wpaperd" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.wpaperd.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.wpaperd.enable) {
|
||||||
programs.wpaperd.settings.any.path = "${config.stylix.image}";
|
programs.wpaperd.settings.any.path = "${config.stylix.image}";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
options.stylix.targets.xfce.enable =
|
options.stylix.targets.xfce.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Xfce" false;
|
config.lib.stylix.mkEnableTarget "Xfce" false;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.xfce.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.xfce.enable) {
|
||||||
xfconf.settings = with config.stylix.fonts; {
|
xfconf.settings = with config.stylix.fonts; {
|
||||||
xfwm4 = {
|
xfwm4 = {
|
||||||
"general/title_font" = "${sansSerif.name} ${toString sizes.desktop}";
|
"general/title_font" = "${sansSerif.name} ${toString sizes.desktop}";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
options.stylix.targets.xresources.enable =
|
options.stylix.targets.xresources.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Xresources" true;
|
config.lib.stylix.mkEnableTarget "Xresources" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.xresources.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.xresources.enable) {
|
||||||
xresources.properties = with config.lib.stylix.colors.withHashtag; with config.stylix.fonts; {
|
xresources.properties = with config.lib.stylix.colors.withHashtag; with config.stylix.fonts; {
|
||||||
"*.faceName" = monospace.name;
|
"*.faceName" = monospace.name;
|
||||||
"*.faceSize" = sizes.terminal;
|
"*.faceSize" = sizes.terminal;
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
options.stylix.targets.yazi = {
|
options.stylix.targets.yazi = {
|
||||||
enable = config.lib.stylix.mkEnableTarget "Yazi" config.programs.yazi.enable;
|
enable = config.lib.stylix.mkEnableTarget "Yazi" true;
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.yazi.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.yazi.enable) {
|
||||||
programs.yazi.theme = with config.lib.stylix.colors.withHashtag; let
|
programs.yazi.theme = with config.lib.stylix.colors.withHashtag; let
|
||||||
mkFg = fg: {inherit fg;};
|
mkFg = fg: {inherit fg;};
|
||||||
mkBg = bg: {inherit bg;};
|
mkBg = bg: {inherit bg;};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
options.stylix.targets.zathura.enable =
|
options.stylix.targets.zathura.enable =
|
||||||
config.lib.stylix.mkEnableTarget "Zathura" true;
|
config.lib.stylix.mkEnableTarget "Zathura" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.zathura.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.zathura.enable) {
|
||||||
programs.zathura.options = let
|
programs.zathura.options = let
|
||||||
highlightTransparency = "0.5";
|
highlightTransparency = "0.5";
|
||||||
getColorCh = colorName: channel: config.lib.stylix.colors."${colorName}-rgb-${channel}";
|
getColorCh = colorName: channel: config.lib.stylix.colors."${colorName}-rgb-${channel}";
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
options.stylix.targets.zellij.enable =
|
options.stylix.targets.zellij.enable =
|
||||||
config.lib.stylix.mkEnableTarget "zellij" config.programs.zellij.enable ;
|
config.lib.stylix.mkEnableTarget "zellij" true;
|
||||||
|
|
||||||
config = lib.mkIf config.stylix.targets.zellij.enable {
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.zellij.enable) {
|
||||||
programs.zellij.settings = {
|
programs.zellij.settings = {
|
||||||
theme = "stylix";
|
theme = "stylix";
|
||||||
themes.stylix = with config.lib.stylix.colors.withHashtag; {
|
themes.stylix = with config.lib.stylix.colors.withHashtag; {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{ config, ... }:
|
{ config, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.stylix.fonts;
|
cfg = config.stylix.fonts;
|
||||||
in {
|
in {
|
||||||
imports = [ ../fonts.nix ];
|
imports = [ ../fonts.nix ];
|
||||||
config.fonts = {
|
config.fonts = lib.mkIf config.stylix.enable {
|
||||||
fontDir.enable = true;
|
fontDir.enable = true;
|
||||||
fonts = cfg.packages;
|
fonts = cfg.packages;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
args:
|
args:
|
||||||
{ config, ... }:
|
{ config, lib, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ (import ../palette.nix args) ];
|
imports = [ (import ../palette.nix args) ];
|
||||||
|
|
||||||
config = {
|
config = lib.mkIf config.stylix.enable {
|
||||||
environment.etc = config.stylix.generated.fileTree;
|
environment.etc = config.stylix.generated.fileTree;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = lib.mkIf config.stylix.enable {
|
||||||
stylix.fonts.packages = [
|
stylix.fonts.packages = [
|
||||||
cfg.monospace.package
|
cfg.monospace.package
|
||||||
cfg.serif.package
|
cfg.serif.package
|
||||||
|
|
|
@ -7,7 +7,7 @@ let
|
||||||
in {
|
in {
|
||||||
imports = [ ../cursor.nix ];
|
imports = [ ../cursor.nix ];
|
||||||
|
|
||||||
config = mkIf pkgs.stdenv.hostPlatform.isLinux {
|
config = mkIf (config.stylix.enable && pkgs.stdenv.hostPlatform.isLinux) {
|
||||||
home.pointerCursor = {
|
home.pointerCursor = {
|
||||||
name = cfg.name;
|
name = cfg.name;
|
||||||
package = cfg.package;
|
package = cfg.package;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{ config, ... }:
|
{ config, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.stylix.fonts;
|
cfg = config.stylix.fonts;
|
||||||
in {
|
in {
|
||||||
imports = [ ../fonts.nix ];
|
imports = [ ../fonts.nix ];
|
||||||
config = {
|
config = lib.mkIf config.stylix.enable {
|
||||||
fonts.fontconfig.enable = true;
|
fonts.fontconfig.enable = true;
|
||||||
home.packages = cfg.packages;
|
home.packages = cfg.packages;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
args:
|
args:
|
||||||
{ config, ... }:
|
{ config, lib, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ (import ../palette.nix args) ];
|
imports = [ (import ../palette.nix args) ];
|
||||||
|
|
||||||
config = {
|
config = lib.mkIf config.stylix.enable {
|
||||||
xdg.configFile = config.stylix.generated.fileTree;
|
xdg.configFile = config.stylix.generated.fileTree;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{ config, ... }:
|
{ config, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.stylix.cursor;
|
cfg = config.stylix.cursor;
|
||||||
in {
|
in {
|
||||||
imports = [ ../cursor.nix ];
|
imports = [ ../cursor.nix ];
|
||||||
config = {
|
config = lib.mkIf config.stylix.enable {
|
||||||
environment.variables.XCURSOR_SIZE = toString cfg.size;
|
environment.variables.XCURSOR_SIZE = toString cfg.size;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{ config, ... }:
|
{ config, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.stylix.fonts;
|
cfg = config.stylix.fonts;
|
||||||
in {
|
in {
|
||||||
imports = [ ../fonts.nix ];
|
imports = [ ../fonts.nix ];
|
||||||
config.fonts = {
|
config.fonts = lib.mkIf config.stylix.enable {
|
||||||
packages = cfg.packages;
|
packages = cfg.packages;
|
||||||
|
|
||||||
fontconfig.defaultFonts = {
|
fontconfig.defaultFonts = {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
args:
|
args:
|
||||||
{ config, ... }:
|
{ config, lib, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ (import ../palette.nix args) ];
|
imports = [ (import ../palette.nix args) ];
|
||||||
|
|
||||||
config = {
|
config = lib.mkIf config.stylix.enable {
|
||||||
environment.etc = config.stylix.generated.fileTree;
|
environment.etc = config.stylix.generated.fileTree;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,32 +3,48 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
{
|
{
|
||||||
options.stylix.autoEnable =
|
options.stylix = {
|
||||||
mkEnableOption
|
enable = mkOption {
|
||||||
"styling installed targets"
|
description = ''
|
||||||
// {
|
Whether to enable Stylix.
|
||||||
|
|
||||||
|
When this is `false`, all theming is disabled and all other options
|
||||||
|
are ignored.
|
||||||
|
'';
|
||||||
|
type = types.bool;
|
||||||
|
default = import ./fromos.nix { inherit lib args; } [ "enable" ] false;
|
||||||
|
example = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
autoEnable = mkOption {
|
||||||
|
description = ''
|
||||||
|
Whether to enable targets by default.
|
||||||
|
|
||||||
|
When this is `false`, all targets are disabled unless explicitly enabled.
|
||||||
|
|
||||||
|
When this is `true`, most targets are enabled by default. A small number
|
||||||
|
remain off by default, because they require further manual setup, or
|
||||||
|
they are only applicable in specific circumstances which cannot be
|
||||||
|
detected automatically.
|
||||||
|
'';
|
||||||
|
type = types.bool;
|
||||||
default = import ./fromos.nix { inherit lib args; } [ "autoEnable" ] true;
|
default = import ./fromos.nix { inherit lib args; } [ "autoEnable" ] true;
|
||||||
example = false;
|
example = false;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
config.lib.stylix.mkEnableTarget =
|
config.lib.stylix.mkEnableTarget = let
|
||||||
|
cfg = config.stylix;
|
||||||
|
in
|
||||||
humanName:
|
humanName:
|
||||||
|
|
||||||
# If the module only touches options under its target (programs.target.*)
|
|
||||||
# then this can simply be `true`, as those options are already gated by the
|
|
||||||
# upstream enable option.
|
|
||||||
#
|
|
||||||
# Otherwise, use `config` to check whether the target is enabled.
|
|
||||||
#
|
|
||||||
# If some manual setup is required, or the module leads to the target
|
|
||||||
# being installed if it wasn't already, set this to `false`.
|
|
||||||
autoEnable:
|
autoEnable:
|
||||||
mkEnableOption
|
mkEnableOption
|
||||||
"styling for ${humanName}"
|
"theming for ${humanName}"
|
||||||
// {
|
// {
|
||||||
default = config.stylix.autoEnable && autoEnable;
|
default = cfg.enable && cfg.autoEnable && autoEnable;
|
||||||
|
example = !autoEnable;
|
||||||
}
|
}
|
||||||
// optionalAttrs autoEnable {
|
// optionalAttrs autoEnable {
|
||||||
defaultText = literalExpression "stylix.autoEnable";
|
defaultText = literalMD "same as [`stylix.autoEnable`](#stylixautoenable)";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue