mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-13 04:21:08 +01:00
radio-active: add module to create config files
Configuration entry similar to; ```nix programs.radio-active.enable = true; ``` By default `ffplay` is used for recording/playback, but that can be changed by applying either of the following; ```nix programs.radio-active.settings.AppConfig.player = "vlc"; programs.radio-active.settings.AppConfig.player = "mpv"; ``` All other configuration options documented by; https://github.com/deep5050/radio-active?tab=readme-ov-file#default-configs maybe applied under the `AppConfig` attribute set. Finally, the `aliases` attribute set allows for defining key/value pares that will generate a `~/.radio-active-alias` of bookmarked stations, for example something like; ```nix programs.radio-active.aliases = { "Deep House Lounge" = "http://198.15.94.34:8006/stream"; }; ``` ... will result in; ``` Deep House Lounge==http://198.15.94.34:8006/stream ``` WARN: Darwin hosts may report issues about `pkgs.vlc` Co-authored-by: Robert Helgesson <robert@rycee.net>
This commit is contained in:
parent
26ace005b7
commit
1dbb3fd2f7
8 changed files with 284 additions and 0 deletions
32
tests/modules/programs/radio-active/AppConfig.nix
Normal file
32
tests/modules/programs/radio-active/AppConfig.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
programs.radio-active = {
|
||||
enable = true;
|
||||
|
||||
settings.AppConfig = {
|
||||
filepath = "/mnt/{user}/recordings/radioactive/";
|
||||
filetype = "auto";
|
||||
filter = "name=shows";
|
||||
limit = 41;
|
||||
loglevel = "debug";
|
||||
player = "ffplay";
|
||||
sort = "random";
|
||||
volume = 68;
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/radio-active/configs.ini
|
||||
assertFileContent home-files/.config/radio-active/configs.ini \
|
||||
${builtins.toFile "expected.radio-active_configs.ini" ''
|
||||
[AppConfig]
|
||||
filepath=/mnt/{user}/recordings/radioactive/
|
||||
filetype=auto
|
||||
filter=name=shows
|
||||
limit=41
|
||||
loglevel=debug
|
||||
player=ffplay
|
||||
sort=random
|
||||
volume=68
|
||||
''}
|
||||
'';
|
||||
}
|
||||
32
tests/modules/programs/radio-active/AppConfig_all.nix
Normal file
32
tests/modules/programs/radio-active/AppConfig_all.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
programs.radio-active = {
|
||||
enable = true;
|
||||
|
||||
settings.AppConfig = {
|
||||
filepath = "/home/{user}/recordings/radioactive/";
|
||||
filetype = "mp3";
|
||||
filter = "none";
|
||||
limit = 41;
|
||||
loglevel = "debug";
|
||||
player = "ffplay";
|
||||
sort = "votes";
|
||||
volume = 68;
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/radio-active/configs.ini
|
||||
assertFileContent home-files/.config/radio-active/configs.ini \
|
||||
${builtins.toFile "expected.all.radio-active_configs.ini" ''
|
||||
[AppConfig]
|
||||
filepath=/home/{user}/recordings/radioactive/
|
||||
filetype=mp3
|
||||
filter=none
|
||||
limit=41
|
||||
loglevel=debug
|
||||
player=ffplay
|
||||
sort=votes
|
||||
volume=68
|
||||
''}
|
||||
'';
|
||||
}
|
||||
16
tests/modules/programs/radio-active/AppConfig_player_mpv.nix
Normal file
16
tests/modules/programs/radio-active/AppConfig_player_mpv.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
programs.radio-active = {
|
||||
enable = true;
|
||||
|
||||
settings.AppConfig.player = "mpv";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/radio-active/configs.ini
|
||||
assertFileContent home-files/.config/radio-active/configs.ini \
|
||||
${builtins.toFile "expected.player_mpv.radio-active_configs.ini" ''
|
||||
[AppConfig]
|
||||
player=mpv
|
||||
''}
|
||||
'';
|
||||
}
|
||||
16
tests/modules/programs/radio-active/AppConfig_player_vlc.nix
Normal file
16
tests/modules/programs/radio-active/AppConfig_player_vlc.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
programs.radio-active = {
|
||||
enable = true;
|
||||
|
||||
settings.AppConfig.player = "vlc";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/radio-active/configs.ini
|
||||
assertFileContent home-files/.config/radio-active/configs.ini \
|
||||
${builtins.toFile "expected.player_mpv.radio-active_configs.ini" ''
|
||||
[AppConfig]
|
||||
player=vlc
|
||||
''}
|
||||
'';
|
||||
}
|
||||
17
tests/modules/programs/radio-active/aliases.nix
Normal file
17
tests/modules/programs/radio-active/aliases.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
programs.radio-active = {
|
||||
enable = true;
|
||||
|
||||
aliases = {
|
||||
"Deep House Lounge" = "http://198.15.94.34:8006/stream";
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.radio-active-alias
|
||||
assertFileContent home-files/.radio-active-alias \
|
||||
${builtins.toFile "expected.radio-active_aliases.ini" ''
|
||||
Deep House Lounge==http://198.15.94.34:8006/stream
|
||||
''}
|
||||
'';
|
||||
}
|
||||
11
tests/modules/programs/radio-active/default.nix
Normal file
11
tests/modules/programs/radio-active/default.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{ lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
radio-active-aliases = ./aliases.nix;
|
||||
radio-active-AppConfig = ./AppConfig.nix;
|
||||
radio-active-AppConfig_all = ./AppConfig_all.nix;
|
||||
radio-active-AppConfig_player_mpv = ./AppConfig_player_mpv.nix;
|
||||
}
|
||||
// lib.optionalAttrs (pkgs.stdenv.hostPlatform.isDarwin != true) {
|
||||
radio-active-AppConfig_player_vlc = ./AppConfig_player_vlc.nix;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue