steal stylix from MaxMur

Signed-off-by: unexplrd <unexplrd@linerds.us>
This commit is contained in:
2025-04-03 17:57:49 +03:00
parent 211e509628
commit 6fc63520e9
12 changed files with 156 additions and 303 deletions

View File

@ -1,7 +1,8 @@
{
imports = [
./locale.nix
./opentabletdriver.nix
./qmk-vial.nix
./locale.nix
./stylix.nix
];
}

View File

@ -0,0 +1,139 @@
{
config,
inputs,
lib,
pkgs,
...
}: let
inherit (lib) mkEnableOption mkOption mkIf;
inherit (lib) optionalAttrs;
inherit (lib.types) bool str;
inherit (config.system) stateVersion;
cfg = config.module.stylix;
cursorSize = 32;
iosevkaPackage =
if stateVersion == "24.11"
then pkgs.nerdfonts.override {fonts = ["Iosevka"];}
else pkgs.nerd-fonts.iosevka;
iosevkaTermPackage =
if stateVersion == "24.11"
then pkgs.nerdfonts.override {fonts = ["Iosevka Term"];}
else pkgs.nerd-fonts.iosevka-term;
themes = {
nord = {
polarity = "dark";
scheme = "${pkgs.base16-schemes}/share/themes/nord.yaml";
wallpaper = builtins.fetchurl {
url = "https://w.wallhaven.cc/full/l8/wallhaven-l8l9gq.png";
name = "wallhaven-l8l9gq.png";
sha256 = "0ypr44sg0fn55m1b52dgr1nnscpi2p6rfkjsm7vvrdqw7bafbx2z";
};
serif = {
package = iosevkaPackage;
name = "Iosevka Nerd Font Propo";
};
monospace = {
package = iosevkaTermPackage;
name = "IosevkaTerm Nerd Font Mono";
};
cursor = {
package = pkgs.nordzy-cursor-theme;
name = "Nordzy-cursors";
};
};
nord-light = {
polarity = "light";
scheme = "${pkgs.base16-schemes}/share/themes/nord-light.yaml";
wallpaper = builtins.fetchurl {
url = "https://w.wallhaven.cc/full/l8/wallhaven-l8l9gq.png";
name = "wallhaven-l8l9gq.png";
sha256 = "0ypr44sg0fn55m1b52dgr1nnscpi2p6rfkjsm7vvrdqw7bafbx2z";
};
serif = {
package = iosevkaPackage;
name = "Iosevka Nerd Font Propo";
};
monospace = {
package = iosevkaTermPackage;
name = "IosevkaTerm Nerd Font Mono";
};
cursor = {
package = pkgs.nordzy-cursor-theme;
name = "Nordzy-cursors-white";
};
};
};
in {
imports = with inputs; [
stylix.nixosModules.stylix
];
options = {
module.stylix = {
enable = mkEnableOption "enable stylix";
useCursor = mkOption {
type = bool;
default = true;
description = "enable cursor settings";
};
theme = mkOption {
type = str;
default = "nord";
};
};
};
config = mkIf cfg.enable {
stylix =
{
enable = true;
image = themes.${cfg.theme}.wallpaper;
autoEnable = true;
polarity = themes.${cfg.theme}.polarity;
base16Scheme = themes.${cfg.theme}.scheme;
opacity = {
applications = 1.0;
terminal = 1.0;
popups = 1.0;
desktop = 1.0;
};
fonts = {
sizes = {
applications = 13;
terminal = 13;
popups = 14;
desktop = 13;
};
serif = {
inherit (themes.${cfg.theme}.serif) package name;
};
sansSerif = config.stylix.fonts.serif;
monospace = {
inherit (themes.${cfg.theme}.monospace) package name;
};
emoji = config.stylix.fonts.serif;
};
}
// optionalAttrs cfg.useCursor {
cursor = {
inherit (themes.${cfg.theme}.cursor) package name;
size = cursorSize;
};
};
};
}