101 lines
3.9 KiB
Nix
101 lines
3.9 KiB
Nix
{
|
|
user ? throw "user argument is required",
|
|
}:
|
|
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
hmConfig = config.home-manager.users.${user.name};
|
|
in
|
|
{
|
|
home-manager.users.${user.name} = {
|
|
imports = [ ./options.nix ];
|
|
|
|
programs.matugen = {
|
|
enable = true;
|
|
settings = {
|
|
config = {
|
|
custom_colors =
|
|
let
|
|
mkColor = category: color: {
|
|
color = hmConfig.theme.color.${category}.${color};
|
|
blend = hmConfig.theme.color.${category}.blend;
|
|
};
|
|
in
|
|
{
|
|
danger = mkColor "semantic" "danger";
|
|
warning = mkColor "semantic" "warning";
|
|
success = mkColor "semantic" "success";
|
|
info = mkColor "semantic" "info";
|
|
|
|
red = mkColor "basic" "red";
|
|
orange = mkColor "basic" "orange";
|
|
yellow = mkColor "basic" "yellow";
|
|
green = mkColor "basic" "green";
|
|
cyan = mkColor "basic" "cyan";
|
|
blue = mkColor "basic" "blue";
|
|
magenta = mkColor "basic" "magenta";
|
|
pink = mkColor "basic" "magenta";
|
|
|
|
keywords = mkColor "syntax" "keywords";
|
|
functions = mkColor "syntax" "functions";
|
|
properties = mkColor "syntax" "properties";
|
|
constants = mkColor "syntax" "constants";
|
|
strings = mkColor "syntax" "strings";
|
|
numbers = mkColor "syntax" "numbers";
|
|
structures = mkColor "syntax" "structures";
|
|
types = mkColor "syntax" "types";
|
|
};
|
|
|
|
custom_keywords =
|
|
let
|
|
zeroPad = hex: if builtins.stringLength hex == 1 then "0${hex}" else hex;
|
|
percentageToHex = percentage: zeroPad (lib.trivial.toHexString (builtins.floor (percentage * 255)));
|
|
in
|
|
{
|
|
flavour = hmConfig.theme.flavour;
|
|
contrast = builtins.toString hmConfig.theme.contrast;
|
|
radius = builtins.toString hmConfig.theme.radius;
|
|
padding = builtins.toString hmConfig.theme.padding;
|
|
padding_double = builtins.toString (hmConfig.theme.padding * 2);
|
|
blur = builtins.toString hmConfig.theme.blur;
|
|
opacity = builtins.toString hmConfig.theme.opacity;
|
|
opacity_hex = builtins.toString (percentageToHex hmConfig.theme.opacity);
|
|
opacity_shadow = builtins.toString (hmConfig.theme.opacity * 0.75);
|
|
opacity_shadow_hex = builtins.toString (percentageToHex (hmConfig.theme.opacity * 0.75));
|
|
font_size = builtins.toString hmConfig.theme.font.size;
|
|
font_sans_serif = builtins.head hmConfig.theme.font.sansSerif.names;
|
|
font_sans_serif_all = builtins.concatStringsSep ", " hmConfig.theme.font.sansSerif.names;
|
|
font_serif = builtins.head hmConfig.theme.font.serif.names;
|
|
font_serif_all = builtins.concatStringsSep ", " hmConfig.theme.font.serif.names;
|
|
font_monospace = builtins.head hmConfig.theme.font.monospace.names;
|
|
font_monospace_all = builtins.concatStringsSep ", " hmConfig.theme.font.monospace.names;
|
|
font_emoji = builtins.head hmConfig.theme.font.emoji.names;
|
|
font_emoji_all = builtins.concatStringsSep ", " hmConfig.theme.font.emoji.names;
|
|
};
|
|
};
|
|
|
|
templates = { };
|
|
};
|
|
};
|
|
|
|
theme.extraConfig = lib.mkBefore (
|
|
lib.meta.getExe (
|
|
pkgs.writeShellApplication {
|
|
name = "theme-matugen";
|
|
runtimeInputs = with pkgs; [ matugen ];
|
|
text = ''
|
|
exec matugen image "${hmConfig.theme.configDir}/wallpaper" \
|
|
--type scheme-${hmConfig.theme.flavour} \
|
|
--mode "$(cat "${hmConfig.theme.configDir}/mode")" \
|
|
--contrast ${builtins.toString hmConfig.theme.contrast}
|
|
'';
|
|
}
|
|
)
|
|
);
|
|
};
|
|
}
|