feat(home-manager): add support for cava (#121)

This commit is contained in:
Henri Sota 2024-04-16 18:44:26 +02:00 committed by GitHub
parent a5e5595911
commit 04fc060234
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 76 additions and 2 deletions

View file

@ -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",
@ -599,4 +619,4 @@
},
"version": "0adc53028d81bf047461bc61c43a484d11b15220"
}
}
}

View file

@ -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";

View file

@ -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);
};
}

View file

@ -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
@ -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

View file

@ -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"

View file

@ -58,6 +58,7 @@ in
bat = ctpEnable;
bottom = ctpEnable;
btop = ctpEnable;
cava = ctpEnable;
fish = ctpEnable;
fzf = ctpEnable;
git.enable = true; # Required for delta