mirror of
https://github.com/nix-community/home-manager
synced 2024-12-23 10:19:48 +01:00
cavalier: add module
This commit is contained in:
parent
c903b1f6fb
commit
f47b6c153a
9 changed files with 234 additions and 0 deletions
|
@ -1909,6 +1909,16 @@ in {
|
|||
and thefuck replacement written in Rust.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2024-12-22T08:24:29+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'programs.cavalier'.
|
||||
|
||||
Cavalier is a GUI wrapper around the Cava audio visualizer.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -77,6 +77,7 @@ let
|
|||
./programs/bun.nix
|
||||
./programs/carapace.nix
|
||||
./programs/cava.nix
|
||||
./programs/cavalier.nix
|
||||
./programs/chromium.nix
|
||||
./programs/cmus.nix
|
||||
./programs/command-not-found/command-not-found.nix
|
||||
|
|
102
modules/programs/cavalier.nix
Normal file
102
modules/programs/cavalier.nix
Normal file
|
@ -0,0 +1,102 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.cavalier;
|
||||
|
||||
iniFmt = pkgs.formats.ini { };
|
||||
|
||||
jsonFmt = pkgs.formats.json { };
|
||||
|
||||
in {
|
||||
meta.maintainers = [ hm.maintainers.bricked ];
|
||||
|
||||
options.programs.cavalier = {
|
||||
enable = mkEnableOption "Cava audio visualizer GUI";
|
||||
|
||||
package = mkPackageOption pkgs "cavalier" { };
|
||||
|
||||
settings = {
|
||||
general = mkOption {
|
||||
type = jsonFmt.type;
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
ShowControls = true;
|
||||
ColorProfiles = [
|
||||
{
|
||||
Name = "Default";
|
||||
FgColors = [
|
||||
"#ffed333b"
|
||||
"#ffffa348"
|
||||
"#fff8e45c"
|
||||
"#ff57e389"
|
||||
"#ff62a0ea"
|
||||
"#ffc061cb"
|
||||
];
|
||||
BgColors = [
|
||||
"#ff1e1e2e"
|
||||
];
|
||||
Theme = 1;
|
||||
}
|
||||
];
|
||||
ActiveProfile = 0;
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Settings to be written to the Cavalier configuration file. See
|
||||
<https://github.com/NickvisionApps/Cavalier/blob/main/NickvisionCavalier.Shared/Models/Configuration.cs>
|
||||
for all available options.
|
||||
'';
|
||||
};
|
||||
|
||||
cava = 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 underlying Cava configuration file. See
|
||||
<https://github.com/karlstav/cava/blob/master/example_files/config> for
|
||||
all available options.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "programs.cavalier" pkgs
|
||||
lib.platforms.linux)
|
||||
];
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile = {
|
||||
"Nickvision Cavalier/config.json" = mkIf (cfg.settings.general != { }) {
|
||||
text = ''
|
||||
${generators.toJSON { } cfg.settings.general}
|
||||
'';
|
||||
};
|
||||
|
||||
"Nickvision Cavalier/cava_config" = mkIf (cfg.settings.cava != { }) {
|
||||
text = ''
|
||||
; Generated by Home Manager
|
||||
|
||||
${generators.toINI { } cfg.settings.cava}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -199,6 +199,7 @@ in import nmtSrc {
|
|||
./modules/programs/beets # One test relies on services.mpd
|
||||
./modules/programs/bemenu
|
||||
./modules/programs/boxxy
|
||||
./modules/programs/cavalier
|
||||
./modules/programs/firefox/firefox.nix
|
||||
./modules/programs/firefox/floorp.nix
|
||||
./modules/programs/foot
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
; Generated by Home Manager
|
||||
|
||||
[general]
|
||||
autosens=1
|
||||
bars=12
|
||||
framerate=60
|
||||
sensitivity=100
|
||||
|
||||
[input]
|
||||
method=pulse
|
||||
|
||||
[output]
|
||||
bit_format=16bit
|
||||
channels=stereo
|
||||
method=raw
|
||||
raw_target=/dev/stdout
|
||||
|
||||
[smoothing]
|
||||
monstercat=1
|
||||
noise_reduction=77
|
||||
|
35
tests/modules/programs/cavalier/cavalier-cava-settings.nix
Normal file
35
tests/modules/programs/cavalier/cavalier-cava-settings.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.cavalier = {
|
||||
enable = true;
|
||||
|
||||
package = config.lib.test.mkStubPackage { };
|
||||
|
||||
settings.cava = {
|
||||
general = {
|
||||
framerate = 60;
|
||||
bars = 12;
|
||||
autosens = 1;
|
||||
sensitivity = 100;
|
||||
};
|
||||
input = { method = "pulse"; };
|
||||
output = {
|
||||
method = "raw";
|
||||
raw_target = "/dev/stdout";
|
||||
bit_format = "16bit";
|
||||
channels = "stereo";
|
||||
};
|
||||
smoothing = {
|
||||
monstercat = 1;
|
||||
noise_reduction = 77;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
configFile="home-files/.config/Nickvision Cavalier/cava_config"
|
||||
assertFileExists "$configFile"
|
||||
assertFileContent "$configFile" ${./cavalier-cava-settings-expected.ini}
|
||||
'';
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{"ActiveProfile":0,"AreaMargin":0,"AreaOffsetX":0,"AreaOffsetY":0,"AutohideHeader":false,"Autosens":true,"BarPairs":6,"BgImageAlpha":1,"BgImageIndex":-1,"BgImageScale":1,"Borderless":false,"ColorProfiles":[{"BgColors":["#ff242424"],"FgColors":["#ff3584e4"],"Name":"Default","Theme":1}],"Direction":1,"FgImageAlpha":1,"FgImageIndex":-1,"FgImageScale":1,"Filling":true,"Framerate":60,"InnerRadius":0.5,"ItemsOffset":0.1,"ItemsRoundness":0.5,"LinesThickness":5,"Mirror":0,"Mode":0,"Monstercat":true,"NoiseReduction":0.77,"ReverseMirror":false,"ReverseOrder":true,"Rotation":0,"Sensitivity":10,"SharpCorners":false,"ShowControls":false,"Stereo":true,"WindowHeight":521,"WindowMaximized":false,"WindowWidth":1908}
|
|
@ -0,0 +1,59 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.cavalier = {
|
||||
enable = true;
|
||||
|
||||
package = config.lib.test.mkStubPackage { };
|
||||
|
||||
settings.general = {
|
||||
WindowWidth = 1908;
|
||||
WindowHeight = 521;
|
||||
WindowMaximized = false;
|
||||
AreaMargin = 0;
|
||||
AreaOffsetX = 0;
|
||||
AreaOffsetY = 0;
|
||||
Borderless = false;
|
||||
SharpCorners = false;
|
||||
ShowControls = false;
|
||||
AutohideHeader = false;
|
||||
Framerate = 60;
|
||||
BarPairs = 6;
|
||||
Autosens = true;
|
||||
Sensitivity = 10;
|
||||
Stereo = true;
|
||||
Monstercat = true;
|
||||
NoiseReduction = 0.77;
|
||||
ReverseOrder = true;
|
||||
Direction = 1;
|
||||
ItemsOffset = 0.1;
|
||||
ItemsRoundness = 0.5;
|
||||
Filling = true;
|
||||
LinesThickness = 5;
|
||||
Mode = 0;
|
||||
Mirror = 0;
|
||||
ReverseMirror = false;
|
||||
InnerRadius = 0.5;
|
||||
Rotation = 0;
|
||||
ColorProfiles = [{
|
||||
Name = "Default";
|
||||
FgColors = [ "#ff3584e4" ];
|
||||
BgColors = [ "#ff242424" ];
|
||||
Theme = 1;
|
||||
}];
|
||||
ActiveProfile = 0;
|
||||
BgImageIndex = -1;
|
||||
BgImageScale = 1;
|
||||
BgImageAlpha = 1;
|
||||
FgImageIndex = -1;
|
||||
FgImageScale = 1;
|
||||
FgImageAlpha = 1;
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
configFile="home-files/.config/Nickvision Cavalier/config.json"
|
||||
assertFileExists "$configFile"
|
||||
assertFileContent "$configFile" ${./cavalier-general-settings-expected.json}
|
||||
'';
|
||||
}
|
4
tests/modules/programs/cavalier/default.nix
Normal file
4
tests/modules/programs/cavalier/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
cavalier-general-settings = ./cavalier-general-settings.nix;
|
||||
cavalier-cava-settings = ./cavalier-cava-settings.nix;
|
||||
}
|
Loading…
Reference in a new issue