Skip to content

Commit

Permalink
feat(home-manager): add support for cava (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
henrisota authored Apr 16, 2024
1 parent a5e5595 commit 04fc060
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 2 deletions.
22 changes: 21 additions & 1 deletion _sources/generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,26 @@
},
"version": "c6469190f2ecf25f017d6120bf4e050e6b1d17af"
},
"cava": {
"cargoLocks": null,
"date": "2024-04-01",
"extract": null,
"name": "cava",
"passthru": null,
"pinned": false,
"src": {
"deepClone": false,
"fetchSubmodules": false,
"leaveDotGit": false,
"name": null,
"owner": "catppuccin",
"repo": "cava",
"rev": "56c1e69318856a853b28e3ccce500c00099dc051",
"sha256": "sha256-FNNEYFurT6Y6rkKrvyAGt+3a+7GO4UE5el2sJ2ZKX2k=",
"type": "github"
},
"version": "56c1e69318856a853b28e3ccce500c00099dc051"
},
"delta": {
"cargoLocks": null,
"date": "2024-03-23",
Expand Down Expand Up @@ -599,4 +619,4 @@
},
"version": "0adc53028d81bf047461bc61c43a484d11b15220"
}
}
}
12 changes: 12 additions & 0 deletions _sources/generated.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@
};
date = "2023-10-07";
};
cava = {
pname = "cava";
version = "56c1e69318856a853b28e3ccce500c00099dc051";
src = fetchFromGitHub {
owner = "catppuccin";
repo = "cava";
rev = "56c1e69318856a853b28e3ccce500c00099dc051";
fetchSubmodules = false;
sha256 = "sha256-FNNEYFurT6Y6rkKrvyAGt+3a+7GO4UE5el2sJ2ZKX2k=";
};
date = "2024-04-01";
};
delta = {
pname = "delta";
version = "765eb17d0268bf07c20ca439771153f8bc79444f";
Expand Down
18 changes: 18 additions & 0 deletions modules/home-manager/cava.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{ config
, lib
, sources
, ...
}:
let
inherit (lib) ctp;
cfg = config.programs.cava.catppuccin;
enable = cfg.enable && config.programs.cava.enable;
in
{
options.programs.cava.catppuccin =
lib.ctp.mkCatppuccinOpt "cava";

config.programs.cava = lib.mkIf enable {
settings = lib.ctp.fromINIRaw (sources.cava + /themes/${cfg.flavour}.cava);
};
}
21 changes: 20 additions & 1 deletion modules/lib/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{ config, lib, pkgs, ... }:
{ config
, lib
, pkgs
, ...
}:
let
# string -> type -> string -> a -> a
# this is an internal function and shouldn't be
Expand Down Expand Up @@ -80,6 +84,21 @@ in
in
fromJSON (readFile json);

# a -> path -> a
# fromJSON but for raw ini (and without readFile)
# a should be the local pkgs attrset
fromINIRaw = file:
let
inherit (builtins) fromJSON readFile;

# convert to json
json = with pkgs;
runCommand "converted.json" { } ''
${jc}/bin/jc --ini -r < ${file} > $out
'';
in
fromJSON (readFile json);

# string -> a -> a
# this creates a basic attrset only containing an
# enable and flavour option. the fist string should
Expand Down
4 changes: 4 additions & 0 deletions nvfetcher.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ fetch.github = "catppuccin/bottom"
src.git = "https://github.com/catppuccin/btop.git"
fetch.github = "catppuccin/btop"

[cava]
src.git = "https://github.com/catppuccin/cava.git"
fetch.github = "catppuccin/cava"

[delta]
src.git = "https://github.com/catppuccin/delta.git"
fetch.github = "catppuccin/delta"
Expand Down
1 change: 1 addition & 0 deletions test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ in
bat = ctpEnable;
bottom = ctpEnable;
btop = ctpEnable;
cava = ctpEnable;
fish = ctpEnable;
fzf = ctpEnable;
git.enable = true; # Required for delta
Expand Down

0 comments on commit 04fc060

Please sign in to comment.