diff --git a/modules/home-manager/alacritty.nix b/modules/home-manager/alacritty.nix new file mode 100644 index 0000000..80d875a --- /dev/null +++ b/modules/home-manager/alacritty.nix @@ -0,0 +1,35 @@ +{ config, pkgs, lib, ... }: +let cfg = config.programs.alacritty.catppuccin; +in { + options.programs.alacritty.catppuccin = with lib; { + enable = mkEnableOption "Catppuccin theme"; + flavour = mkOption { + type = types.enum [ "latte" "frappe" "macchiato" "mocha" ]; + default = config.catppuccin.flavour; + description = "Catppuccin flavour for alacritty"; + }; + }; + + config.programs.alacritty.settings = with builtins; + with lib; + with pkgs; + let + # path -> a + # fromJSON but for yaml + fromYaml = file: + let + # convert to json + json = runCommand "converted.json" { } '' + ${yj}/bin/yj < ${file} > $out + ''; + in fromJSON (readFile json); + + file = fetchFromGitHub { + owner = "catppuccin"; + repo = "alacritty"; + rev = "3c808cbb4f9c87be43ba5241bc57373c793d2f17"; + sha256 = "sha256-w9XVtEe7TqzxxGUCDUR9BFkzLZjG8XrplXJ3lX6f+x0="; + } + "/catppuccin-${cfg.flavour}.yml"; + + in mkIf cfg.enable (fromYaml file); +} diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 4fc2cc3..437defd 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1,5 +1,6 @@ { config, pkgs, lib, ... }: { imports = [ + ./alacritty.nix ./bat.nix ./bottom.nix ./kitty.nix