From c5eeae703f20176a421fde57e76842cc4f4c453d Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 15 Apr 2023 19:48:38 -0400 Subject: [PATCH] feat(home-manager): add support for alacritty (#22) --- modules/home-manager/alacritty.nix | 35 ++++++++++++++++++++++++++++++ modules/home-manager/default.nix | 1 + 2 files changed, 36 insertions(+) create mode 100644 modules/home-manager/alacritty.nix 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