1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-09 12:06:04 +01:00

twitch-tui: add module (#7416)

This commit is contained in:
Aguirre Matteo 2025-07-08 14:52:03 +00:00 committed by GitHub
parent c00730550e
commit 5751fa774f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 96 additions and 0 deletions

View file

@ -0,0 +1,56 @@
{
lib,
pkgs,
config,
...
}:
let
inherit (lib)
mkIf
mkEnableOption
mkPackageOption
mkOption
;
cfg = config.programs.twitch-tui;
tomlFormat = pkgs.formats.toml { };
in
{
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
options.programs.twitch-tui = {
enable = mkEnableOption "twitch-tui";
package = mkPackageOption pkgs "twitch-tui" { nullable = true; };
settings = mkOption {
type = tomlFormat.type;
default = { };
example = {
twitch = {
username = "";
channel = "";
server = "wss://eventsub.wss.twitch.tv/ws";
token = "";
};
terminal = {
delay = 30;
maximum_messages = 500;
log_file = "";
log_level = "info";
first_state = "dashboard";
};
};
description = ''
Configuration settings for twitch-tui. All the available options
can be found here: <https://github.com/Xithrius/twitch-tui/blob/main/default-config.toml>
'';
};
};
config = mkIf cfg.enable {
home.packages = mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."twt/config.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "twitch-tui-config" cfg.settings;
};
};
}

View file

@ -0,0 +1,12 @@
[terminal]
delay = 30
first_state = "dashboard"
log_file = ""
log_level = "info"
maximum_messages = 500
[twitch]
channel = ""
server = "wss://eventsub.wss.twitch.tv/ws"
token = ""
username = ""

View file

@ -0,0 +1 @@
{ twitch-tui-example = ./example-config.nix; }

View file

@ -0,0 +1,27 @@
{
programs.twitch-tui = {
enable = true;
settings = {
twitch = {
username = "";
channel = "";
server = "wss://eventsub.wss.twitch.tv/ws";
token = "";
};
terminal = {
delay = 30;
maximum_messages = 500;
log_file = "";
log_level = "info";
first_state = "dashboard";
};
};
};
nmt.script = ''
assertFileExists home-files/.config/twt/config.toml
assertFileContent home-files/.config/twt/config.toml \
${./config.toml}
'';
}