Style : Move font cfg etc to Style from Stylix.

This commit is contained in:
Dmitry Voronin 2024-07-01 16:19:58 +03:00
parent 40e51ace25
commit 505eccdd4a
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
5 changed files with 65 additions and 60 deletions

View file

@ -1,10 +1,11 @@
{ lib, config, ... }: with lib; let
{ lib, config, pkgs, __findFile, ... }: 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;
mkPkgOption = default: mkTypeOption default types.package;
in {
options.style = {
color = {
@ -61,24 +62,42 @@ in {
};
font = {
emoji.name = mkStrOption config.stylix.fonts.emoji.name;
monospace.name = mkStrOption config.stylix.fonts.monospace.name;
sansSerif.name = mkStrOption config.stylix.fonts.sansSerif.name;
serif.name = mkStrOption config.stylix.fonts.serif.name;
size = {
terminal = mkIntOption config.stylix.fonts.sizes.terminal;
popup = mkIntOption config.stylix.fonts.sizes.popups;
application = mkIntOption config.stylix.fonts.sizes.applications;
desktop = mkIntOption config.stylix.fonts.sizes.desktop;
application = mkIntOption 12;
terminal = mkIntOption 14;
popup = mkIntOption 12;
desktop = mkIntOption 14;
};
serif = {
package = mkPkgOption (pkgs.callPackage <package/applefont> {});
name = mkStrOption "SF Pro Display";
};
sansSerif = {
package = mkPkgOption (pkgs.callPackage <package/applefont> {});
name = mkStrOption "SF Pro Display";
};
monospace = {
package = mkPkgOption (pkgs.nerdfonts.override { fonts = [ "Terminus" ]; });
name = mkStrOption "Terminess Nerd Font Mono";
};
emoji = {
package = mkPkgOption pkgs.noto-fonts-emoji;
name = mkStrOption "Noto Color Emoji";
};
};
opacity = {
application = mkFloatOption config.stylix.opacity.applications;
desktop = mkFloatOption config.stylix.opacity.desktop;
popup = mkFloatOption config.stylix.opacity.popups;
terminal = mkFloatOption config.stylix.opacity.terminal;
hex = mkStrOption "D9";
application = mkFloatOption 0.85;
desktop = mkFloatOption 0.85;
popup = mkFloatOption 0.85;
terminal = mkFloatOption 0.85;
hex = mkStrOption "D9";
};
cursor = {
name = mkStrOption "Adwaita";
package = mkPkgOption pkgs.gnome3.adwaita-icon-theme;
size = mkIntOption 14;
};
window = {

View file

@ -4,40 +4,20 @@
image = config.module.wallpaper.path;
autoEnable = true;
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 <package/applefont> {});
name = "SF Pro Display";
};
in {
inherit serif;
fonts = {
inherit (config.style.font) serif sansSerif monospace emoji;
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";
inherit (config.style.font.size) terminal desktop;
popups = config.style.font.size.popup;
applications = config.style.font.size.application;
};
};
opacity = {
inherit (config.style.opacity) desktop terminal;
applications = config.style.opacity.application;
popups = config.style.opacity.popups;
};
inherit (config.style) cursor;
override = if config.module.wallpaper.forceContrastText then {
base04 = "000000";
base05 = "ffffff";

View file

@ -298,11 +298,12 @@
];
# Android.
nixOnDroidConfigurations.default = nix-on-droid.lib.nixOnDroidConfiguration {
modules = let
lib = nixpkgs.lib;
config = self.nixOnDroidConfigurations.default.config;
in [
nixOnDroidConfigurations.default = let
config = self.nixOnDroidConfigurations.default.config;
lib = nixpkgs.lib;
pkgs = nixpkgs.legacyPackages."aarch64-linux".pkgs;
in nix-on-droid.lib.nixOnDroidConfiguration {
modules = [
# Android release version.
{ system.stateVersion = self.const.droidStateVersion; }
@ -318,15 +319,15 @@
# Some common modules.
./config/Setting.nix
./config/Wallpaper.nix
(import ./config/Style.nix { inherit lib; inherit (config.home-manager) config; })
(import ./config/Style.nix {
inherit (config.home-manager) config;
inherit (self) __findFile;
inherit lib pkgs;
})
];
# SpecialArgs allows you to pass objects down to other configuration.
extraSpecialArgs = let
# We want arm64 packages for Android.
pkgs = nixpkgs.legacyPackages."aarch64-linux".pkgs;
lib = nixpkgs.lib;
in {
extraSpecialArgs = {
inherit inputs self;
inherit (self) const __findFile;

View file

@ -34,9 +34,7 @@ in {
".termux/_colors.properties".text = android.colors;
};
};
# ISSUE: Firefox causes inf rec for some reason.
# programs = import ./program args;
programs = (import ./program args) // { firefox = {}; };
programs = import ./program args;
};
};
}

View file

@ -2,7 +2,7 @@
# This is a systemd service that pulls updates every hour.
# Unlike system.autoUpgrade, this script also verifies my git signature
# to prevent unathorized changes to hosts.
{ const, pkgs, lib, util, config, ... }: with lib; let
{ const, pkgs, lib, util, config, secret, ... }: with lib; let
cfg = config.module.autoupdate;
in {
options = {
@ -12,6 +12,13 @@ in {
};
config = mkIf cfg.enable {
programs.git = {
enable = true;
config = {
gpg.ssh.allowedSignersFile = toString secret.crypto.sign.git.allowed;
};
};
systemd.services.autoupdate = util.mkStaticSystemdService {
enable = true;
description = "Signed system auto-update.";