Android : Use common Style & Stylix modules.

This commit is contained in:
Dmitry Voronin 2024-06-29 23:44:54 +03:00
parent bd75d95dad
commit 6f50947621
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
4 changed files with 14 additions and 226 deletions

View file

@ -1,89 +0,0 @@
{ lib, config, ... }: with lib; let
cfg = config.style;
mkTypeOption = default: type: mkOption { inherit default type; };
mkStrOption = default: mkTypeOption default types.str;
mkIntOption = default: mkTypeOption default types.int;
mkFloatOption = default: mkTypeOption default types.float;
in {
options.style = {
color = {
bg = {
dark = mkStrOption config.home-manager.config.lib.stylix.colors.base00;
light = mkStrOption config.home-manager.config.lib.stylix.colors.base07;
regular = mkStrOption config.home-manager.config.lib.stylix.colors.base01;
};
fg = {
dark = mkStrOption config.home-manager.config.lib.stylix.colors.base04;
light = mkStrOption config.home-manager.config.lib.stylix.colors.base06;
regular = mkStrOption config.home-manager.config.lib.stylix.colors.base05;
};
accent = mkStrOption config.home-manager.config.lib.stylix.colors.base0A;
heading = mkStrOption config.home-manager.config.lib.stylix.colors.base0D;
hl = mkStrOption config.home-manager.config.lib.stylix.colors.base03;
keyword = mkStrOption config.home-manager.config.lib.stylix.colors.base0E;
link = mkStrOption config.home-manager.config.lib.stylix.colors.base09;
misc = mkStrOption config.home-manager.config.lib.stylix.colors.base0F;
negative = mkStrOption config.home-manager.config.lib.stylix.colors.base08;
neutral = mkStrOption config.home-manager.config.lib.stylix.colors.base0C;
positive = mkStrOption config.home-manager.config.lib.stylix.colors.base0B;
selection = mkStrOption config.home-manager.config.lib.stylix.colors.base02;
transparent = mkStrOption "ffffff00";
accent-b = mkStrOption config.home-manager.config.lib.stylix.colors.base0A-rgb-b;
accent-g = mkStrOption config.home-manager.config.lib.stylix.colors.base0A-rgb-g;
accent-r = mkStrOption config.home-manager.config.lib.stylix.colors.base0A-rgb-r;
negative-b = mkStrOption config.home-manager.config.lib.stylix.colors.base08-rgb-b;
negative-g = mkStrOption config.home-manager.config.lib.stylix.colors.base08-rgb-g;
negative-r = mkStrOption config.home-manager.config.lib.stylix.colors.base08-rgb-r;
neutral-b = mkStrOption config.home-manager.config.lib.stylix.colors.base0C-rgb-b;
neutral-g = mkStrOption config.home-manager.config.lib.stylix.colors.base0C-rgb-g;
neutral-r = mkStrOption config.home-manager.config.lib.stylix.colors.base0C-rgb-r;
positive-b = mkStrOption config.home-manager.config.lib.stylix.colors.base0B-rgb-b;
positive-g = mkStrOption config.home-manager.config.lib.stylix.colors.base0B-rgb-g;
positive-r = mkStrOption config.home-manager.config.lib.stylix.colors.base0B-rgb-r;
bg-b = mkStrOption config.home-manager.config.lib.stylix.colors.base00-rgb-b;
bg-g = mkStrOption config.home-manager.config.lib.stylix.colors.base00-rgb-g;
bg-r = mkStrOption config.home-manager.config.lib.stylix.colors.base00-rgb-r;
fg-b = mkStrOption config.home-manager.config.lib.stylix.colors.base06-rgb-b;
fg-g = mkStrOption config.home-manager.config.lib.stylix.colors.base06-rgb-g;
fg-r = mkStrOption config.home-manager.config.lib.stylix.colors.base06-rgb-r;
border = mkStrOption config.home-manager.config.lib.stylix.colors.base01;
border-b = mkStrOption config.home-manager.config.lib.stylix.colors.base01-rgb-b;
border-g = mkStrOption config.home-manager.config.lib.stylix.colors.base01-rgb-g;
border-r = mkStrOption config.home-manager.config.lib.stylix.colors.base01-rgb-r;
};
font = {
emoji.name = mkStrOption config.home-manager.config.stylix.fonts.emoji.name;
monospace.name = mkStrOption config.home-manager.config.stylix.fonts.monospace.name;
sansSerif.name = mkStrOption config.home-manager.config.stylix.fonts.sansSerif.name;
serif.name = mkStrOption config.home-manager.config.stylix.fonts.serif.name;
size = {
terminal = mkIntOption config.home-manager.config.stylix.fonts.sizes.terminal;
popup = mkIntOption config.home-manager.config.stylix.fonts.sizes.popups;
application = mkIntOption config.home-manager.config.stylix.fonts.sizes.applications;
desktop = mkIntOption config.home-manager.config.stylix.fonts.sizes.desktop;
};
};
opacity = {
application = mkFloatOption config.home-manager.config.stylix.opacity.applications;
desktop = mkFloatOption config.home-manager.config.stylix.opacity.desktop;
popup = mkFloatOption config.home-manager.config.stylix.opacity.popups;
terminal = mkFloatOption config.home-manager.config.stylix.opacity.terminal;
hex = mkStrOption "D9";
};
window = {
gap = mkIntOption 8;
border = mkIntOption 4;
};
};
}

View file

@ -26,62 +26,16 @@ in {
# Configure system.
time.timeZone = const.timeZone;
nix.extraOptions = "experimental-features = nix-command flakes";
# stylix.autoEnable = lib.mkForce false;
# Install packages.
environment.packages = package.list;
# Home manager config.
home-manager.config = stylix // {
imports = [
inputs.stylix.homeManagerModules.stylix
];
# stylix = {
# enable = true;
# image = config.module.common.wallpaper.path;
# autoEnable = false;
# polarity = "dark";
# opacity = {
# applications = 0.85;
# terminal = 0.85;
# popups = 0.85;
# desktop = 0.85;
# };
# cursor = {
# name = "Adwaita";
# package = pkgs.gnome3.adwaita-icon-theme;
# size = 14;
# };
# fonts = let
# serif = {
# package = (pkgs.callPackage ../module/common/applefont {});
# name = "SF Pro Display";
# };
# in {
# inherit serif;
# sizes = {
# applications = 12;
# terminal = 14;
# popups = 12;
# desktop = 14;
# };
# sansSerif = serif;
# monospace = {
# package = (pkgs.nerdfonts.override { fonts = [ "Terminus" ]; });
# name = "Terminess Nerd Font Mono";
# };
# emoji = {
# package = pkgs.noto-fonts-emoji;
# name = "Noto Color Emoji";
# };
# };
# override = if config.module.common.wallpaper.forceContrastText then {
# base04 = "000000";
# base05 = "ffffff";
# base06 = "ffffff";
# } else {};
# };
home = {
# Release version.
stateVersion = const.droidStateVersion;

View file

@ -1,81 +0,0 @@
{ lib, ... }: with lib; let
mkTypeOption = default: type: mkOption { inherit default type; };
mkStrOption = default: mkTypeOption default types.str;
mkIntOption = default: mkTypeOption default types.int;
mkFloatOption = default: mkTypeOption default types.float;
in {
options.style = {
color = {
bg = {
dark = mkStrOption "1d2021";
light = mkStrOption "504945";
regular = mkStrOption "3c3836";
};
fg = {
dark = mkStrOption "a89984";
light = mkStrOption "fbf1c7";
regular = mkStrOption "ebdbb2";
};
accent = mkStrOption "b8bb26";
heading = mkStrOption "d5c4a1";
hl = mkStrOption "98971a";
keyword = mkStrOption "98971a";
link = mkStrOption "076678";
misc = mkStrOption "808080";
negative = mkStrOption "cc241d";
neutral = mkStrOption "458588";
positive = mkStrOption "87af87";
selection = mkStrOption "87af87";
transparent = mkStrOption "ffffff00";
accent-b = mkStrOption "38";
accent-g = mkStrOption "187";
accent-r = mkStrOption "184";
negative-b = mkStrOption "29";
negative-g = mkStrOption "36";
negative-r = mkStrOption "204";
neutral-b = mkStrOption "136";
neutral-g = mkStrOption "133";
neutral-r = mkStrOption "69";
positive-b = mkStrOption "135";
positive-g = mkStrOption "175";
positive-r = mkStrOption "135";
bg-b = mkStrOption "33";
bg-g = mkStrOption "32";
bg-r = mkStrOption "29";
fg-b = mkStrOption "199";
fg-g = mkStrOption "241";
fg-r = mkStrOption "251";
border = mkStrOption "3c3836";
border-b = mkStrOption "54";
border-g = mkStrOption "56";
border-r = mkStrOption "60";
};
fonts = {
monospace.name = mkStrOption "Terminess Nerd Font Mono";
emoji.name = mkStrOption "Noto Color Emoji";
serif.name = mkStrOption "SF Pro Display";
sansSerif.name = mkStrOption "SF Pro Display";
sizes = {
applications = mkIntOption 12;
terminal = mkIntOption 12;
popups = mkIntOption 12;
desktop = mkIntOption 12;
};
};
opacity = {
application = mkFloatOption 1.0;
desktop = mkFloatOption 1.0;
popup = mkFloatOption 1.0;
terminal = mkFloatOption 1.0;
};
};
}

View file

@ -247,16 +247,20 @@
# Android.
nixOnDroidConfigurations.default = nix-on-droid.lib.nixOnDroidConfiguration {
modules = [
modules = let
lib = nixpkgs.lib;
config = self.nixOnDroidConfigurations.default.config;
in [
# Android release version.
{ system.stateVersion = self.const.droidStateVersion; }
# I put all my Android configuration there.
./android
./android/Style.nix
# Some common modules.
./module/common/Setting.nix
./module/common/Wallpaper.nix
(import ./module/common/Style.nix { inherit lib; inherit (config.home-manager) config; })
];
# SpecialArgs allows you to pass objects down to other configuration.