feat: stylix?

This commit is contained in:
Kat Inskip 2025-07-26 17:06:28 -07:00
parent 2b1fd9b99e
commit d6d4d38dcc
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
33 changed files with 465 additions and 629 deletions

View file

@ -1,76 +0,0 @@
{
config,
pkgs,
lib,
std,
...
}: let
inherit (lib.options) mkOption;
inherit (lib.types) attrsOf str enum;
inherit (lib.modules) mkIf;
inherit (std) string set tuple list;
cfg = config.base16;
in {
options.base16 = {
palette = mkOption {
type = attrsOf str;
};
sass = {
variables = mkOption {
type = attrsOf str;
default =
cfg.palette
// {
term_font = "Iosevka";
font = "Iosevka";
font_size = "12px";
};
};
css_style = mkOption {
type = enum ["nested" "compressed" "compact" "expanded"];
default = "expanded";
};
};
};
config = mkIf (cfg.schemes != {}) {
base16 = {
palette = set.fromList (set.mapToValues (
k: v:
tuple.tuple2
k
"#${v.hex}"
)
(set.filter (n: _: string.hasPrefix "base" n)
cfg.defaultScheme));
};
lib.kittywitch.sassTemplate = {
name,
src,
}: let
variables = pkgs.writeText "base-variables.sass" ''
${(string.concatSep "\n" (set.mapToValues (var: con: "\$${var}: ${con}") cfg.sass.variables))}
'';
source =
pkgs.callPackage
({
sass,
stdenv,
}:
stdenv.mkDerivation {
inherit name src variables;
nativeBuildInputs = list.singleton pkgs.sass;
phases = ["buildPhase"];
buildPhase = ''
cat $variables $src > src-mut.sass
sass src-mut.sass $out --sourcemap=none --trace --style=${cfg.sass.css_style}
'';
})
{};
in {
inherit source;
text = builtins.readFile source;
};
_module.args = {inherit (config.lib) kittywitch;};
};
}

View file

@ -1,17 +0,0 @@
# Taken from: https://git.gay/olivia/fur/src/branch/main/modules/home/palette/default.nix
{
config,
pkgs,
lib,
...
}: let
inherit (lib) mkOption types;
palette =
(pkgs.lib.importJSON (config.catppuccin.sources.palette + "/palette.json"))
.${config.catppuccin.flavor}.colors;
in {
options.palette = mkOption {type = types.attrsOf types.raw;};
config = {
inherit palette;
};
}