From b5ecd9cab6fdc8a865fd95f198c895e978b190ce Mon Sep 17 00:00:00 2001 From: punkfairie Date: Sun, 20 Oct 2024 11:14:35 -0700 Subject: [PATCH] feat(kitty): Catppuccin -> Rose Pine --- .sources/sources.json | 12 ++++++++++++ modules/home-manager/kitty.nix | 34 +++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/.sources/sources.json b/.sources/sources.json index 94b51a8..d0e145a 100644 --- a/.sources/sources.json +++ b/.sources/sources.json @@ -168,6 +168,18 @@ "url": "https://github.com/sasoria/k9s-theme/archive/4ed8c473f16642b894bb501f1cd979fb670cce2d.tar.gz", "hash": "17lrv30wiql6i0ll33wng9ziizlzg9kx0wa960i900crfcq94168" }, + "kitty": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "rose-pine", + "repo": "kitty" + }, + "branch": "main", + "revision": "788bf1bf1a688dff9bbacbd9e516d83ac7dbd216", + "url": "https://github.com/rose-pine/kitty/archive/788bf1bf1a688dff9bbacbd9e516d83ac7dbd216.tar.gz", + "hash": "0a5r70q7g29b3fwz3i6rlj8jkyw5rc1pv92icndyc6lbb291bhq1" + }, "lazygit": { "type": "Git", "repository": { diff --git a/modules/home-manager/kitty.nix b/modules/home-manager/kitty.nix index a20c96c..eaa38bb 100644 --- a/modules/home-manager/kitty.nix +++ b/modules/home-manager/kitty.nix @@ -1,15 +1,27 @@ -{ config, lib, ... }: -let - inherit (lib) ctp; - cfg = config.programs.kitty.catppuccin; +{ + config, + lib, + ... +}: let + inherit (config.rose-pine) sources; + + cfg = config.programs.kitty.rose-pine; enable = cfg.enable && config.programs.kitty.enable; - # TODO: Remove after 24.11 is stable - # https://github.com/nix-community/home-manager/pull/5750 - attrName = if (lib.versionAtLeast ctp.getModuleRelease "24.11") then "themeFile" else "theme"; -in -{ - options.programs.kitty.catppuccin = ctp.mkCatppuccinOpt { name = "kitty"; }; + themeName = + if (cfg.flavor == "main") + then "rose-pine" + else "rose-pine-${cfg.flavor}"; + themePath = "themes/${themeName}.conf"; + theme = sources.kitty + "/dist/${themeName}.conf"; +in { + options.programs.kitty.rose-pine = lib.rp.mkRosePineOpt {name = "kitty";}; - config = lib.mkIf enable { programs.kitty.${attrName} = "Catppuccin-${ctp.mkUpper cfg.flavor}"; }; + config = lib.mkIf enable { + xdg.configFile."kitty/${themePath}".source = theme; + + programs.kitty.settings = { + include = themePath; + }; + }; }