Skip to content

Conversation

S0AndS0
Copy link
Member

@S0AndS0 S0AndS0 commented Sep 8, 2025

WARN:

Description

Configuration entry similar to;

programs.radio-active.enable = true;

... will produce default configuration ~/.radio-active-configs.ini

[AppConfig]
filepath = /home/{user}/recordings/radioactive/
filetype = mp3
filter = none
limit = 100
loglevel = info
player = ffplay
sort = name
volume = 80

By default ffplay is used for recording/playback, but that can be changed by applying either of the following;

programs.radio-active.appConfig.player = "vlc";
programs.radio-active.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;

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

Checklist

  • Change is backwards compatible.

    Nope

  • Code formatted with nix fmt or
    nix-shell -p treefmt nixfmt deadnix keep-sorted --run treefmt.

  • Code tested through nix run .#tests -- test-all or
    nix-shell --pure tests -A run.all.

    Note; had to do --impure and import local pkgs due to pending PR over at NixOS/nixpkgs#441029, but should work once that's accepted and flake.lock is updated here ;-)

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.
    • Generate a news entry. See News
    • Basic tests added. See Tests
  • If this PR adds an exciting new feature or contains a breaking change.

    • Generate a news entry. See News

@S0AndS0 S0AndS0 marked this pull request as draft September 8, 2025 22:20
@S0AndS0 S0AndS0 force-pushed the add-radio-active branch 4 times, most recently from 1df94e4 to 321718f Compare September 15, 2025 17:06
@S0AndS0 S0AndS0 marked this pull request as ready for review September 15, 2025 17:06
@S0AndS0 S0AndS0 force-pushed the add-radio-active branch 2 times, most recently from f7b2370 to e9e2ad9 Compare September 15, 2025 19:34
@S0AndS0
Copy link
Member Author

S0AndS0 commented Sep 15, 2025

It seems CI/CD will need flake.lock updated for NixOS/nixpkgs to be at or beyond commit bb2ae01ef06ec5d7e5765cf3e9494439900b5d73 (2025-09-07)


type = submodule {
options = {
AppConfig = mkOption {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest the following structure instead:

  • Make programs.radio-active.settings match this AppConfig option.
  • Move the aliases option to the top.

With the above a valid configuration could be

{
  enable = true;
  settings.limit = 30;
  aliases = {
    "Deep House Lounge" = "http://198.15.94.34:8006/stream";
  };
}

Copy link
Member Author

@S0AndS0 S0AndS0 Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configuration file could have more than AppConfig bits defined, configs like;

[AppConfig]
# ... stuff for "AppConfig" settings...

... map to a Python dictionary sorta like configs['AppConfig']['player'] -> "ffplay"

So lifting AppConfig into the config.programs.radio-active.settings attribute set could lead to future churn when (if) additional sections are added to the configuration file.

Currently is not an issue but, as I'm currently the fork maintainer submitted to NixOS/nixpkgs for the program, I also hesitate to reduce future flexibility.


edit for example I may wanna add something like [PlayerConfig] to enable passing extra CLI args

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, then the settings can include the AppConfig attribute. Can just move the aliases option.

@S0AndS0 S0AndS0 force-pushed the add-radio-active branch 3 times, most recently from f3800ca to a1112cc Compare September 25, 2025 20:02
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.settings.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: must be applied after NixOS/nixpkgs#441029
WARN: requires update of `flake.lock` too
WARN: Darwin hosts may report issues about `pkgs.vlc`

Co-authored-by: Robert Helgesson <[email protected]>
@S0AndS0
Copy link
Member Author

S0AndS0 commented Sep 25, 2025

Hmm; recent force-push, after satisfying linter, seems to show that Darwin don't got pkgs.vlc?

https://buildbot.nix-community.org/api/v2/logs/1487024/raw_inline

...
error: Package ‘vlc-3.0.21’ in /nix/store/yw0wijix50n0y2ii15sk8kvnwgalpq6f-source/pkgs/by-name/vl/vlc/package.nix:322 is not available on the requested hostPlatform:
...

Grep-ing about via grep -rinE 'platform' tests/modules shows others, like tests/modules/services/osmscout-server/default.nix, are leveraging pkgs.stdenv.hostPlatform.isLinux to make certain tests conditional. So that's what I'm gonna do for tests/modules/programs/radio-active/default.nix until told otherwise.

Comment on lines +170 to +172
lib.warn ''
Unknown player defined in `config.programs.radio-active.AppConfig.player`
'' pkgs.radio-active;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warnings should go in the warnings option, that way they are presented consistently. See, e.g.,

warnings = lib.optional (cfg.package == null && cfg.enableGitIntegration) ''
You have enabled git integration for `bun` but have not set `package`.
Git integration will not be configured.
'';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants