mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-09 03:56:04 +01:00
twitch-tui: add module (#7416)
This commit is contained in:
parent
c00730550e
commit
5751fa774f
4 changed files with 96 additions and 0 deletions
56
modules/programs/twitch-tui.nix
Normal file
56
modules/programs/twitch-tui.nix
Normal 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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
12
tests/modules/programs/twitch-tui/config.toml
Normal file
12
tests/modules/programs/twitch-tui/config.toml
Normal 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 = ""
|
||||||
1
tests/modules/programs/twitch-tui/default.nix
Normal file
1
tests/modules/programs/twitch-tui/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{ twitch-tui-example = ./example-config.nix; }
|
||||||
27
tests/modules/programs/twitch-tui/example-config.nix
Normal file
27
tests/modules/programs/twitch-tui/example-config.nix
Normal 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}
|
||||||
|
'';
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue