2022-02-26 23:42:01 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.programs.tiny;
|
|
|
|
format = pkgs.formats.yaml { };
|
|
|
|
configDir = if pkgs.stdenv.isDarwin then
|
|
|
|
"Library/Application Support/tiny"
|
|
|
|
else
|
|
|
|
"${config.xdg.configHome}/tiny";
|
|
|
|
in {
|
|
|
|
meta.maintainers = [ hm.maintainers.kmaasrud ];
|
|
|
|
|
|
|
|
options = {
|
|
|
|
programs.tiny = {
|
2023-07-02 01:45:18 +02:00
|
|
|
enable = mkEnableOption "tiny, a TUI IRC client written in Rust";
|
2022-02-26 23:42:01 +01:00
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.tiny;
|
|
|
|
defaultText = literalExpression "pkgs.tiny";
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "The {command}`tiny` package to install.";
|
2022-02-26 23:42:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
settings = mkOption {
|
|
|
|
type = format.type;
|
|
|
|
default = { };
|
|
|
|
defaultText = literalExpression "{ }";
|
|
|
|
example = literalExpression ''
|
|
|
|
{
|
|
|
|
servers = [
|
2022-06-15 15:49:39 +02:00
|
|
|
{
|
|
|
|
addr = "irc.libera.chat";
|
|
|
|
port = 6697;
|
2022-02-26 23:42:01 +01:00
|
|
|
tls = true;
|
|
|
|
realname = "John Doe";
|
|
|
|
nicks = [ "tinyuser" ];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
defaults = {
|
|
|
|
nicks = [ "tinyuser" ];
|
|
|
|
realname = "John Doe";
|
|
|
|
join = [];
|
|
|
|
tls = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
'';
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2022-02-26 23:42:01 +01:00
|
|
|
Configuration written to
|
2023-07-01 01:30:13 +02:00
|
|
|
{file}`$XDG_CONFIG_HOME/tiny/config.yml`. See
|
|
|
|
<https://github.com/osa1/tiny/blob/master/crates/tiny/config.yml>
|
2022-02-26 23:42:01 +01:00
|
|
|
for the default configuration.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
|
|
|
|
home.file."${configDir}/config.yml" = mkIf (cfg.settings != { }) {
|
|
|
|
source = format.generate "tiny-config" cfg.settings;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|