Move some (all) files around

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-07-08 20:01:55 +03:00
parent 9dfbe1203d
commit 7ab40e3493
103 changed files with 202 additions and 217 deletions

View File

@@ -0,0 +1,99 @@
{
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 "ansi" "red";
green = mkColor "ansi" "green";
yellow = mkColor "ansi" "yellow";
orange = mkColor "ansi" "orange";
blue = mkColor "ansi" "blue";
magenta = mkColor "ansi" "magenta";
cyan = mkColor "ansi" "cyan";
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}
'';
}
)
);
};
}

View File

@@ -0,0 +1,30 @@
{
config,
pkgs,
lib,
...
}:
let
cfg = config.programs.matugen;
in
{
# https://github.com/Theaninova/matugen/blob/add-home-manager-module/hm-module.nix
options.programs.matugen =
with lib;
with types;
{
enable = mkEnableOption "matugen";
package = mkPackageOption pkgs "matugen" { };
settings = mkOption {
type = attrsOf anything;
description = "Settings to write to config.toml.";
};
};
config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."matugen/config.toml".source = lib.mkIf (cfg.settings != null) (
(pkgs.formats.toml { }).generate "matugen" cfg.settings
);
};
}