1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-26 03:39:47 +01:00

cava: add module

This commit is contained in:
Luna Simons 2023-06-16 21:38:29 +02:00 committed by Mikilio
parent 17ead612c6
commit 6da70f2252
No known key found for this signature in database
GPG key ID: 5B2F1A890CF33F3F
7 changed files with 102 additions and 0 deletions

View file

@ -1281,6 +1281,13 @@ in
A new module is available: 'services.darkman'. A new module is available: 'services.darkman'.
''; '';
} }
{
time = "2023-10-24T06:14:53+00:00";
message = ''
A new module is available: 'programs.cava'.
'';
}
]; ];
}; };
} }

View file

@ -70,6 +70,7 @@ let
./programs/browserpass.nix ./programs/browserpass.nix
./programs/btop.nix ./programs/btop.nix
./programs/carapace.nix ./programs/carapace.nix
./programs/cava.nix
./programs/chromium.nix ./programs/chromium.nix
./programs/command-not-found/command-not-found.nix ./programs/command-not-found/command-not-found.nix
./programs/comodoro.nix ./programs/comodoro.nix

52
modules/programs/cava.nix Normal file
View file

@ -0,0 +1,52 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.cava;
iniFmt = pkgs.formats.ini { };
in {
meta.maintainers = [ maintainers.bddvlpr ];
options.programs.cava = {
enable = mkEnableOption "Cava audio visualizer";
package = mkPackageOption pkgs "cava" { };
settings = mkOption {
type = iniFmt.type;
default = { };
example = literalExpression ''
{
general.framerate = 60;
input.method = "alsa";
smoothing.noise_reduction = 88;
color = {
background = "'#000000'";
foreground = "'#FFFFFF'";
};
}
'';
description = ''
Settings to be written to the Cava configuration file. See
<https://github.com/karlstav/cava/blob/master/example_files/config> for
all available options.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."cava/config" = mkIf (cfg.settings != { }) {
text = ''
; Generated by Home Manager
${generators.toINI { } cfg.settings}
'';
};
};
}

View file

@ -70,6 +70,7 @@ import nmt {
./modules/programs/browserpass ./modules/programs/browserpass
./modules/programs/btop ./modules/programs/btop
./modules/programs/carapace ./modules/programs/carapace
./modules/programs/cava
./modules/programs/comodoro ./modules/programs/comodoro
./modules/programs/darcs ./modules/programs/darcs
./modules/programs/dircolors ./modules/programs/dircolors

View file

@ -0,0 +1,15 @@
; Generated by Home Manager
[color]
background='#000000'
foreground='#ffffff'
[general]
framerate=30
[input]
source=alsa
[smoothing]
noise_reduction=65

View file

@ -0,0 +1,25 @@
{ config, pkgs, ... }:
{
programs.cava = {
enable = true;
package = config.lib.test.mkStubPackage { };
settings = {
general.framerate = 30;
input.source = "alsa";
smoothing.noise_reduction = 65;
color = {
background = "'#000000'";
foreground = "'#ffffff'";
};
};
};
nmt.script = ''
configFile=home-files/.config/cava/config
assertFileExists $configFile
assertFileContent $configFile ${./cava-basic-configuration-expected.ini}
'';
}

View file

@ -0,0 +1 @@
{ cava-basic-configuration = ./cava-basic-configuration.nix; }