mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-31 04:04:32 +00:00
easyeffects: add option to import presets
added options to import presets added tests added hausken as maintainer
This commit is contained in:
parent
e4a40b441e
commit
6b8cea6473
7 changed files with 135 additions and 0 deletions
|
@ -2140,6 +2140,14 @@ in {
|
|||
you can use `lib.mkOrder` to specify the order of the content you want to insert.
|
||||
'';
|
||||
}
|
||||
{
|
||||
time = "2025-03-19T18:10:56+00:00";
|
||||
condition = config.services.easyeffects.enable;
|
||||
message = ''
|
||||
The Easyeffects module now supports adding json formatted presets
|
||||
under '$XDG_CONFIG_HOME/easyeffects/{input,output}/'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,6 +8,51 @@ let
|
|||
|
||||
presetOpts = optionalString (cfg.preset != "") "--load-preset ${cfg.preset}";
|
||||
|
||||
jsonFormat = pkgs.formats.json { };
|
||||
|
||||
presetType = let baseType = types.attrsOf jsonFormat.type;
|
||||
in baseType // {
|
||||
check = v:
|
||||
baseType.check v && elem (head (attrNames v)) [ "input" "output" ];
|
||||
description = "EasyEffects input or output JSON preset";
|
||||
};
|
||||
|
||||
presetOptionType = mkOption {
|
||||
type = types.nullOr (types.attrsOf presetType);
|
||||
default = { };
|
||||
description = ''
|
||||
List of presets to import to easyeffects.
|
||||
Presets are written to input and output folder in `$XDG_CONFIG_HOME/easyeffects`.
|
||||
Top level block (input/output) determines the folder the file is written to.
|
||||
|
||||
See community presets at:
|
||||
https://github.com/wwmm/easyeffects/wiki/Community-Presets
|
||||
'';
|
||||
example = literalExpression ''
|
||||
{
|
||||
my-preset = {
|
||||
input = {
|
||||
blocklist = [
|
||||
|
||||
];
|
||||
"plugins_order" = [
|
||||
"rnnoise#0"
|
||||
];
|
||||
"rnnoise#0" = {
|
||||
bypass = false;
|
||||
"enable-vad" = false;
|
||||
"input-gain" = 0.0;
|
||||
"model-path" = "";
|
||||
"output-gain" = 0.0;
|
||||
release = 20.0;
|
||||
"vad-thres" = 50.0;
|
||||
wet = 0.0;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
'';
|
||||
};
|
||||
in {
|
||||
meta.maintainers = [ maintainers.fufexan ];
|
||||
|
||||
|
@ -35,6 +80,8 @@ in {
|
|||
Will likely need to launch easyeffects to initially create preset.
|
||||
'';
|
||||
};
|
||||
|
||||
extraPresets = presetOptionType;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
@ -47,6 +94,13 @@ in {
|
|||
# "AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files"
|
||||
home.packages = with pkgs; [ cfg.package at-spi2-core ];
|
||||
|
||||
xdg.configFile = mkIf (cfg.extraPresets != { }) (lib.mapAttrs' (k: v:
|
||||
# assuming only one of either input or output block is defined, having both in same file not seem to be supported by the application since it separates it by folder
|
||||
let folder = builtins.head (builtins.attrNames v);
|
||||
in lib.nameValuePair "easyeffects/${folder}/${k}.json" {
|
||||
source = jsonFormat.generate "${folder}-${k}.json" v;
|
||||
}) cfg.extraPresets);
|
||||
|
||||
systemd.user.services.easyeffects = {
|
||||
Unit = {
|
||||
Description = "Easyeffects daemon";
|
||||
|
|
|
@ -487,6 +487,7 @@ in import nmtSrc {
|
|||
./modules/services/darkman
|
||||
./modules/services/devilspie2
|
||||
./modules/services/dropbox
|
||||
./modules/services/easyeffects
|
||||
./modules/services/emacs
|
||||
./modules/services/espanso
|
||||
./modules/services/flameshot
|
||||
|
|
4
tests/modules/services/easyeffects/default.nix
Normal file
4
tests/modules/services/easyeffects/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
easyeffects-service = ./service.nix;
|
||||
easyeffects-example-preset = ./example-preset.nix;
|
||||
}
|
18
tests/modules/services/easyeffects/example-preset.json
Normal file
18
tests/modules/services/easyeffects/example-preset.json
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"input": {
|
||||
"blocklist": [],
|
||||
"plugins_order": [
|
||||
"rnnoise#0"
|
||||
],
|
||||
"rnnoise#0": {
|
||||
"bypass": false,
|
||||
"enable-vad": false,
|
||||
"input-gain": 0.0,
|
||||
"model-path": "",
|
||||
"output-gain": 0.0,
|
||||
"release": 20.0,
|
||||
"vad-thres": 50.0,
|
||||
"wet": 0.0
|
||||
}
|
||||
}
|
||||
}
|
36
tests/modules/services/easyeffects/example-preset.nix
Normal file
36
tests/modules/services/easyeffects/example-preset.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
services.easyeffects = {
|
||||
enable = true;
|
||||
extraPresets = {
|
||||
example-preset = {
|
||||
input = {
|
||||
blocklist = [
|
||||
|
||||
];
|
||||
"plugins_order" = [ "rnnoise#0" ];
|
||||
"rnnoise#0" = {
|
||||
bypass = false;
|
||||
"enable-vad" = false;
|
||||
"input-gain" = 0.0;
|
||||
"model-path" = "";
|
||||
"output-gain" = 0.0;
|
||||
release = 20.0;
|
||||
"vad-thres" = 50.0;
|
||||
wet = 0.0;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs.easyeffects = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/easyeffects/input/example-preset.json "${
|
||||
./example-preset.json
|
||||
}"
|
||||
'';
|
||||
}
|
14
tests/modules/services/easyeffects/service.nix
Normal file
14
tests/modules/services/easyeffects/service.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
services.easyeffects = { enable = true; };
|
||||
|
||||
test.stubs.easyeffects = { };
|
||||
|
||||
nmt.script = ''
|
||||
serviceFile=home-files/.config/systemd/user/easyeffects.service
|
||||
|
||||
assertFileExists $serviceFile
|
||||
assertFileRegex $serviceFile 'ExecStart=.*/bin/easyeffects'
|
||||
'';
|
||||
}
|
Loading…
Add table
Reference in a new issue