Flake : Abstract the style.

This commit is contained in:
Dmitry Voronin 2024-04-04 13:51:06 +03:00
parent 05de0d2b60
commit dd1b4ef71f
12 changed files with 154 additions and 62 deletions

107
flake.nix
View file

@ -109,13 +109,110 @@
}; };
# Styles. # Styles.
style = { config , ... }: { style = { config, ... }: {
color_bg = config.lib.stylix.colors.base00; color = {
color_fg = "000000"; accent = config.lib.stylix.colors.base0A;
bg = config.lib.stylix.colors.base01;
bg_dark = config.lib.stylix.colors.base00;
bg_light = config.lib.stylix.colors.base07;
fg = config.lib.stylix.colors.base05;
fg_dark = config.lib.stylix.colors.base04;
fg_light = config.lib.stylix.colors.base06;
heading = config.lib.stylix.colors.base0D;
hl = config.lib.stylix.colors.base03;
keyword = config.lib.stylix.colors.base0E;
link = config.lib.stylix.colors.base09;
misc = config.lib.stylix.colors.base0F;
negative = config.lib.stylix.colors.base08;
neutral = config.lib.stylix.colors.base0C;
positive = config.lib.stylix.colors.base0B;
selection = config.lib.stylix.colors.base02;
transparent = "ffffff00";
accent-b = config.lib.stylix.colors.base0A-rgb-b;
accent-g = config.lib.stylix.colors.base0A-rgb-g;
accent-r = config.lib.stylix.colors.base0A-rgb-r;
negative-b = config.lib.stylix.colors.base08-rgb-b;
negative-g = config.lib.stylix.colors.base08-rgb-g;
negative-r = config.lib.stylix.colors.base08-rgb-r;
neutral-b = config.lib.stylix.colors.base0C-rgb-b;
neutral-g = config.lib.stylix.colors.base0C-rgb-g;
neutral-r = config.lib.stylix.colors.base0C-rgb-r;
positive-b = config.lib.stylix.colors.base0B-rgb-b;
positive-g = config.lib.stylix.colors.base0B-rgb-g;
positive-r = config.lib.stylix.colors.base0B-rgb-r;
}; };
font = {
emoji.name = config.stylix.fonts.emoji.name;
monospace.name = config.stylix.fonts.monospace.name;
sansSerif.name = config.stylix.fonts.sansSerif.name;
serif.name = config.stylix.fonts.serif.name;
size = {
terminal = config.stylix.fonts.sizes.terminal;
popup = config.stylix.fonts.sizes.popups;
application = config.stylix.fonts.sizes.applications;
desktop = config.stylix.fonts.sizes.desktop;
};
};
opacity = {
application = config.stylix.opacity.applications;
desktop = config.stylix.opacity.desktop;
popup = config.stylix.opacity.popups;
terminal = config.stylix.opacity.terminal;
};
};
defaultStyle = { defaultStyle = {
lib.stylix.colors = { lib.stylix.colors = {
base00 = "ffffff"; accent = "b8bb26";
bg = "3c3836";
bg_dark = "1d2021";
bg_light = "504945";
fg = "ebdbb2";
fg_dark = "a89984";
fg_light = "fbf1c7";
heading = "d5c4a1";
hl = "98971a";
keyword = "98971a";
link = "076678";
misc = "808080";
negative = "cc241d";
neutral = "458588";
positive = "87af87";
selection = "87af87";
accent-b = "38";
accent-g = "187";
accent-r = "184";
negative-b = "29";
negative-g = "36";
negative-r = "204";
neutral-b = "136";
neutral-g = "133";
neutral-r = "69";
positive-b = "135";
positive-g = "175";
positive-r = "135";
};
stylix = {
fonts = {
monospace.name = "Terminess Nerd Font Mono";
emoji.name = "Noto Color Emoji";
sans.name = "SF Pro Display";
sansSerif.name = "SF Pro Display";
sizes = {
applications = 12;
terminal = 12;
popups = 12;
desktop = 12;
};
};
opacity = {
application = 1.0;
desktop = 1.0;
popup = 1.0;
terminal = 1.0;
};
}; };
}; };
@ -176,7 +273,7 @@
const = self.nixosModules.const; const = self.nixosModules.const;
flake = self; flake = self;
inputs = inputs; inputs = inputs;
# style = self.style; style = self.style { config = self.nixosConfigurations.${hostname}.config; };
wallpaper = self.wallpaper { pkgs = nixpkgs.legacyPackages.${system}.pkgs; }; wallpaper = self.wallpaper { pkgs = nixpkgs.legacyPackages.${system}.pkgs; };
}; };
}; };

View file

@ -1,5 +1,5 @@
{ pkgs, lib, wallpaper, config, ... }: let { pkgs, lib, wallpaper, style, ... }: let
sway = import ./sway/Config.nix { config = config; pkgs = pkgs; wallpaper = wallpaper; }; sway = import ./sway/Config.nix { pkgs = pkgs; wallpaper = wallpaper; style = style; };
in { in {
imports = [ imports = [
./desktop/App.nix ./desktop/App.nix

View file

@ -1,5 +1,5 @@
{ lib, config, ... }: let { lib, style, ... }: let
bash = import ./bash/Bash.nix { config = config; }; bash = import ./bash/Bash.nix { style = style; };
in { in {
programs.bash.interactiveShellInit = bash.config; programs.bash.interactiveShellInit = bash.config;
environment.shellAliases = lib.mkForce {}; environment.shellAliases = lib.mkForce {};

View file

@ -37,10 +37,5 @@
name = "Noto Color Emoji"; name = "Noto Color Emoji";
}; };
}; };
# targets = {
# foot = {
# enable = true;
# };
# };
}; };
} }

View file

@ -1,23 +1,23 @@
{ config, ... }: let { style, ... }: let
negative-r = config.lib.stylix.colors.base08-rgb-r; accent-b = style.color.accent-b;
negative-g = config.lib.stylix.colors.base08-rgb-g; accent-g = style.color.accent-g;
negative-b = config.lib.stylix.colors.base08-rgb-b; accent-r = style.color.accent-r;
neutral-r = config.lib.stylix.colors.base0C-rgb-r; negative-b = style.color.negative-b;
neutral-g = config.lib.stylix.colors.base0C-rgb-g; negative-g = style.color.negative-g;
neutral-b = config.lib.stylix.colors.base0C-rgb-b; negative-r = style.color.negative-r;
positive-r = config.lib.stylix.colors.base0B-rgb-r; neutral-b = style.color.neutral-b;
positive-g = config.lib.stylix.colors.base0B-rgb-g; neutral-g = style.color.neutral-g;
positive-b = config.lib.stylix.colors.base0B-rgb-b; neutral-r = style.color.neutral-r;
accent-r = config.lib.stylix.colors.base0A-rgb-r; positive-b = style.color.positive-b;
accent-g = config.lib.stylix.colors.base0A-rgb-g; positive-g = style.color.positive-g;
accent-b = config.lib.stylix.colors.base0A-rgb-b; positive-r = style.color.positive-r;
bg = config.lib.stylix.colors.base01; accent = style.color.accent;
fg = config.lib.stylix.colors.base04; bg = style.color.bg_dark;
accent = config.lib.stylix.colors.base06; fg = style.color.fg;
fontNamePopup = config.stylix.fonts.serif.name; fontNamePopup = style.font.serif.name;
fontSizePopup = config.stylix.fonts.sizes.popups; fontSizePopup = style.font.size.popup;
in { in {
config = '' config = ''
# If not running interactively, don't do anything. # If not running interactively, don't do anything.

View file

@ -1,10 +1,10 @@
{ pkgs, wallpaper, config, ... }: let { pkgs, wallpaper, style, ... }: let
accent = config.lib.stylix.colors.base02; accent = style.color.accent;
bg = config.lib.stylix.colors.base00; bg = style.color.bg_dark;
bg_alt = config.lib.stylix.colors.base01; bg_alt = style.color.bg;
fg = config.lib.stylix.colors.base04; fg = style.color.fg;
fg_alt = config.lib.stylix.colors.base05; fg_alt = style.color.fg_dark;
negative = config.lib.stylix.colors.base03; negative = style.color.negative;
in { in {
config = pkgs.writeText "sway_config" '' config = pkgs.writeText "sway_config" ''
# Read `man 5 sway` for a complete reference. # Read `man 5 sway` for a complete reference.

View file

@ -1,11 +1,11 @@
{ const, color, config, pkgs, ... }: { { const, color, style, pkgs, ... }: {
imports = [ imports = [
(import ./Default.nix { (import ./Default.nix {
color = color; color = color;
config = config;
const = const; const = const;
homeDir = "/home/dasha"; homeDir = "/home/dasha";
pkgs = pkgs; pkgs = pkgs;
style = style;
username = "dasha"; username = "dasha";
}) })
]; ];

View file

@ -1,6 +1,6 @@
{ const, username, homeDir, config, pkgs, ... }: let { const, username, homeDir, style, pkgs, ... }: let
footConfig = import ./module/foot/Foot.nix { config = config; }; footConfig = import ./module/foot/Foot.nix { style = style; };
makoConfig = import ./module/mako/Mako.nix { config = config; }; makoConfig = import ./module/mako/Mako.nix { style = style; };
in { in {
home-manager.backupFileExtension = "old"; home-manager.backupFileExtension = "old";

View file

@ -1,11 +1,11 @@
{ const, color, pkgs, config, ... }: { { const, color, pkgs, style, ... }: {
imports = [ imports = [
(import ./Default.nix { (import ./Default.nix {
color = color; color = color;
config = config;
const = const; const = const;
homeDir = "/root"; homeDir = "/root";
pkgs = pkgs; pkgs = pkgs;
style = style;
username = "root"; username = "root";
}) })
]; ];

View file

@ -1,11 +1,11 @@
{ const, color, pkgs, config, ... }: { { const, color, pkgs, style, ... }: {
imports = [ imports = [
(import ./Default.nix { (import ./Default.nix {
color = color; color = color;
config = config;
const = const; const = const;
homeDir = "/home/voronind"; homeDir = "/home/voronind";
pkgs = pkgs; pkgs = pkgs;
style = style;
username = "voronind"; username = "voronind";
}) })
]; ];

View file

@ -1,14 +1,14 @@
{ config, ... }: { { style, ... }: {
config = '' config = ''
font=${config.stylix.fonts.monospace.name}:size=${toString(config.stylix.fonts.sizes.terminal)} font=${style.font.monospace.name}:size=${toString(style.font.size.terminal)}
font-italic=${config.stylix.fonts.monospace.name}:size=${toString(config.stylix.fonts.sizes.terminal)} # font-bold=${style.font.monospace.name}:size=${toString(style.font.size.terminal)}
# font-bold=${config.stylix.fonts.monospace.name}:size=${toString(config.stylix.fonts.sizes.terminal)} font-italic=${style.font.monospace.name}:size=${toString(style.font.size.terminal)}
font-bold-italic=${config.stylix.fonts.monospace.name}:size=${toString(config.stylix.fonts.sizes.terminal)} font-bold-italic=${style.font.monospace.name}:size=${toString(style.font.size.terminal)}
dpi-aware=yes dpi-aware=yes
[colors] [colors]
alpha=${toString(config.stylix.opacity.terminal)} alpha=${toString(style.opacity.terminal)}
background=${config.lib.stylix.colors.base00} background=${style.color.bg_dark}
foreground=${config.lib.stylix.colors.base05} foreground=${style.color.fg}
''; '';
} }

View file

@ -1,10 +1,10 @@
{ config, ... }: { { style, ... }: {
config = ''anchor=top-center config = ''anchor=top-center
default-timeout=5000 default-timeout=5000
font=${config.stylix.fonts.serif.name} ${toString(config.stylix.fonts.sizes.popups)} font=${style.font.serif.name} ${toString(style.font.size.popup)}
background-color=#${config.lib.stylix.colors.base01} background-color=#${style.color.bg}
border-color=#${config.lib.stylix.colors.base01} border-color=#${style.color.bg}
text-color=#${config.lib.stylix.colors.base05} text-color=#${style.color.fg}
height=120 height=120
icons=0 icons=0
margin=32 margin=32