Skip to content

Commit

Permalink
feat(nix): default hm module
Browse files Browse the repository at this point in the history
  • Loading branch information
ozwaldorf committed Jul 17, 2024
1 parent 952cdc2 commit a2f78dc
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 36 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ An IBM Carbon inspired colorscheme.
2. [Usage](#usage)
1. [Nix](#nix)
2. [Patch Tool](#patch-tool)
3. [Examples](#examples)
3. [Config Examples](#config-examples)
1. [Nvim](#nvim)
2. [Wezterm](#wezterm)
3. [Discord](#discord)
Expand All @@ -27,8 +27,6 @@ The current form of this scheme is as a direct patch for [catppuccin](https://gi

Output packages are available through `carburetor.packages.${system}.*`, or as an overlay through `carburetor.overlays.default`.

--

#### `packages.*.carburetor-gtk`

Patched gtk theme
Expand All @@ -50,7 +48,9 @@ Inputs:

Raw discord css themes

---
### Home Manager

Several themes can be setup through home manager.

#### `homeManagerModules.webcord`

Expand All @@ -61,6 +61,8 @@ Options:
- `programs.webcord.carburetor.enable`: `bool`
- `programs.webcord.carburetor.variant`: `regular`|`warm`|`cool`

---

### Patch Tool

There is a simple bash script for patching any existing catppuccin port's hex colors to carburetor. Note that some ports use a css pre-processor to create variations of colors, so they will need to be patched beforehand and then compiled, like [discord](#discord).
Expand All @@ -73,7 +75,9 @@ Options:
TRANSPARENCY: true | false
```

### Examples
---

### Config Examples

#### Nvim

Expand Down
26 changes: 5 additions & 21 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
description = "Overlay for carburetor patched catppuccin packages";

description = "Overlay and modules for carburetor themes";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

outputs =
{ self, nixpkgs }:
let
Expand All @@ -20,32 +18,18 @@
);
in
{
overlays.default = _: prev: {
carburetor-patch = prev.stdenv.mkDerivation {
name = "carburetor-patch";
src = ./.;
installPhase = ''
mkdir -p $out/bin
cp ./patch.sh $out/bin/carburetor-patch
chmod +x $out/bin/carburetor-patch
'';
};
carburetor-gtk = prev.callPackage ./nix/pkgs/gtk.nix { };
carburetor-papirus-folders = prev.callPackage ./nix/pkgs/papirus-folders.nix { };
carburetor-webcord = prev.callPackage ./nix/pkgs/webcord.nix { };
};

overlays.default = import ./nix/pkgs;
packages = forAllSystems (pkgs: {
inherit (pkgs)
carburetor-patch
carburetor-gtk
carburetor-papirus-folders
carburetor-webcord
carburetor-discord
;
});

homeManagerModules = {
webcord = import ./nix/modules/webcord.nix self;
webcord = import ./nix/home/webcord.nix self;
default = import ./nix/home self;
};
};
}
26 changes: 26 additions & 0 deletions nix/home/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
self:
{ lib, config, ... }:
{
options = {
carburetor = {
enable = lib.mkEnableOption "all themes";
accent = lib.mkOption {
type = with lib.types; uniq str;
default = "blue";
description = "Accent color to use. Any catppuccin accent is valid";
};
variant = lib.mkOption {
type = with lib.types; uniq str;
default = "regular";
description = "Variant to use (regular, warm, or cool)";
};
};
};
imports = [ ./webcord.nix ];
config = lib.mkIf config.carburetor.enable {
programs.webcord.carburetor = {
inherit (config.carburetor) accent variant;
enable = true;
};
};
}
15 changes: 9 additions & 6 deletions nix/modules/webcord.nix → nix/home/webcord.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ in
xdg.configFile."WebCord/Themes/carburetor".source =
pkgs.carburetor-webcord
+ "/carburetor"
+ {
regular = "";
warm = "-warm";
cool = "-cool";
}
."${cfg.carburetor.variant}";
+ (
{
regular = "";
warm = "-warm";
cool = "-cool";
}
."${cfg.carburetor.variant}"
)
+ ".css";
};
}
16 changes: 16 additions & 0 deletions nix/pkgs/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
final: prev: {
# Patch tool used to easily modify existing themes
carburetor-patch = prev.stdenv.mkDerivation {
name = "carburetor-patch";
src = ../.;
installPhase = ''
mkdir -p $out/bin
cp ./patch.sh $out/bin/carburetor-patch
chmod +x $out/bin/carburetor-patch
'';
};

carburetor-discord = prev.callPackage ./discord.nix { };
carburetor-gtk = prev.callPackage ./gtk.nix { };
carburetor-papirus-folders = prev.callPackage ./papirus-folders.nix { };
}
8 changes: 4 additions & 4 deletions nix/pkgs/webcord.nix → nix/pkgs/discord.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let
in
pkgs.stdenvNoCC.mkDerivation {
inherit src;
name = "carburetor-webcord";
name = "carburetor-discord";
nativeBuildInputs = [ pkgs.yarn ];
buildPhase = ''
mkdir node_modules
Expand All @@ -26,8 +26,8 @@ pkgs.stdenvNoCC.mkDerivation {
'';
installPhase = ''
mkdir $out
cp dist/dist/catppuccin-mocha.theme.css $out/carburetor
cp dist/dist/catppuccin-macchiato.theme.css $out/carburetor-warm
cp dist/dist/catppuccin-frappe.theme.css $out/carburetor-cool
cp dist/dist/catppuccin-mocha.theme.css $out/carburetor.css
cp dist/dist/catppuccin-macchiato.theme.css $out/carburetor-warm.css
cp dist/dist/catppuccin-frappe.theme.css $out/carburetor-cool.css
'';
}

0 comments on commit a2f78dc

Please sign in to comment.