From 298605b31eebb38e73a9bc5685b28ce1d318b2c8 Mon Sep 17 00:00:00 2001 From: seth Date: Fri, 14 Apr 2023 22:37:39 -0400 Subject: [PATCH] feat(modules): add support for helix (#8) Co-authored-by: Sam Nystrom --- modules/home-manager/default.nix | 1 + modules/home-manager/helix.nix | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 modules/home-manager/helix.nix diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 2a68ca2..a8a474d 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -2,6 +2,7 @@ imports = [ ./bat.nix ./starship.nix + ./helix.nix ./gtk.nix ]; options.catppuccin = { diff --git a/modules/home-manager/helix.nix b/modules/home-manager/helix.nix new file mode 100644 index 0000000..14251f1 --- /dev/null +++ b/modules/home-manager/helix.nix @@ -0,0 +1,30 @@ +{ config, pkgs, lib, ... }: +let cfg = config.programs.helix.catppuccin; +in { + options.programs.helix.catppuccin = with lib; { + enable = mkEnableOption "Catppuccin theme"; + flavour = mkOption { + type = types.enum [ "latte" "frappe" "macchiato" "mocha" ]; + default = config.catppuccin.flavour; + description = "Catppuccin flavour for Helix"; + }; + useItalics = mkEnableOption "Italics in Catppuccin theme for Helix"; + }; + + config.programs.helix = with builtins; + with lib; + with pkgs; + let subdir = if cfg.useItalics then "default" else "no_italics"; + in mkIf cfg.enable { + settings = { + theme = "catppuccin-${cfg.flavour}"; + editor.color-modes = mkDefault true; + }; + themes."catppuccin-${cfg.flavour}" = fromTOML (readFile (fetchFromGitHub { + owner = "catppuccin"; + repo = "helix"; + rev = "5677c16dc95297a804caea9161072ff174018fdd"; + sha256 = "sha256-aa8KZ7/1TXcBqaV/TYOZ8rpusOf5QeQ9i2Upnncbziw="; + } + "/themes/${subdir}/catppuccin_${cfg.flavour}.toml")); + }; +}