Skip to content

Commit

Permalink
feat(home-manager/zed): accent support (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelroses authored Jan 3, 2025
1 parent 63290ea commit 8580fa2
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
29 changes: 23 additions & 6 deletions modules/home-manager/zed-editor.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,47 @@
{ config, lib, ... }:

let
inherit (config.catppuccin) sources;

cfg = config.catppuccin.zed;
in

{
options.catppuccin.zed = catppuccinLib.mkCatppuccinOption { name = "zed"; } // {
italics = lib.mkEnableOption "the italicized version of theme" // {
default = true;
options.catppuccin.zed =
catppuccinLib.mkCatppuccinOption {
name = "zed";
accentSupport = true;
}
// {
italics = lib.mkEnableOption "the italicized version of theme" // {
default = true;
};
};
};

config = lib.mkIf cfg.enable {
programs.zed-editor = {
extensions = [ "catppuccin" ];

userSettings.theme = {
light =
"Catppuccin "
+ catppuccinLib.mkUpper cfg.flavor
+ " ("
+ cfg.accent
+ ")"
+ lib.optionalString (!cfg.italics) " - No Italics";
dark =
"Catppuccin "
+ catppuccinLib.mkUpper cfg.flavor
+ " ("
+ cfg.accent
+ ")"
+ lib.optionalString (!cfg.italics) " - No Italics";
};
};

xdg.configFile = {
"zed/themes/catppuccin.json".source = "${sources.zed}/catppuccin-${
lib.optionalString (!cfg.italics) "no-italics-"
}${cfg.accent}.json";
};
};
}
4 changes: 4 additions & 0 deletions pkgs/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@
"hash": "sha256-/vD/hOi6KcaGyAp6Az7jL5/tQSGRzIrf0oHjAJf4QbI=",
"rev": "0adc53028d81bf047461bc61c43a484d11b15220"
},
"zed": {
"hash": "sha256-QxT9OvhOZCJrtgahwQhtlatHZ15/xRmw4AVfiM6YnFY=",
"rev": "1e4d756b4c71d5568be6c16e73f7a6efe3c4d7ef"
},
"zsh-syntax-highlighting": {
"hash": "sha256-l6tztApzYpQ2/CiKuLBf8vI2imM6vPJuFdNDSEi7T/o=",
"rev": "7926c3d3e17d26b3779851a2255b95ee650bd928"
Expand Down
15 changes: 15 additions & 0 deletions pkgs/zed/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{ buildCatppuccinPort, whiskers }:

buildCatppuccinPort {
pname = "zed";

nativeBuildInputs = [ whiskers ];

buildPhase = ''
runHook preBuild
whiskers zed.tera
runHook postBuild
'';

installTargets = [ "themes" ];
}

0 comments on commit 8580fa2

Please sign in to comment.