mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 11:39:46 +01:00
tiny: add module (#2735)
Added module for tiny, a TUI IRC client written in Rust. Thanks to @ratsclub for helping me write my first Nix module!
This commit is contained in:
parent
ccd00e3c93
commit
1d90b6065a
4 changed files with 74 additions and 0 deletions
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -236,6 +236,8 @@
|
||||||
|
|
||||||
/modules/programs/timidity.nix @amesgen
|
/modules/programs/timidity.nix @amesgen
|
||||||
|
|
||||||
|
/modules/programs/tiny.nix @kmaasrud
|
||||||
|
|
||||||
/modules/programs/topgrade.nix @msfjarvis
|
/modules/programs/topgrade.nix @msfjarvis
|
||||||
/tests/modules/programs/topgrade @msfjarvis
|
/tests/modules/programs/topgrade @msfjarvis
|
||||||
|
|
||||||
|
|
|
@ -217,4 +217,10 @@
|
||||||
github = "mainrs";
|
github = "mainrs";
|
||||||
githubId = 5113257;
|
githubId = 5113257;
|
||||||
};
|
};
|
||||||
|
kmaasrud = {
|
||||||
|
name = "Knut Magnus Aasrud";
|
||||||
|
email = "km@aasrud.com";
|
||||||
|
github = "kmaasrud";
|
||||||
|
githubId = 54394333;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,6 +150,7 @@ let
|
||||||
./programs/texlive.nix
|
./programs/texlive.nix
|
||||||
./programs/timidity.nix
|
./programs/timidity.nix
|
||||||
./programs/tint2.nix
|
./programs/tint2.nix
|
||||||
|
./programs/tiny.nix
|
||||||
./programs/tmux.nix
|
./programs/tmux.nix
|
||||||
./programs/topgrade.nix
|
./programs/topgrade.nix
|
||||||
./programs/urxvt.nix
|
./programs/urxvt.nix
|
||||||
|
|
65
modules/programs/tiny.nix
Normal file
65
modules/programs/tiny.nix
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
{ 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 = {
|
||||||
|
enable = mkEnableOption "tiny, a TUI IRC client written in Rust";
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.tiny;
|
||||||
|
defaultText = literalExpression "pkgs.tiny";
|
||||||
|
description = "The <command>tiny</command> package to install.";
|
||||||
|
};
|
||||||
|
|
||||||
|
settings = mkOption {
|
||||||
|
type = format.type;
|
||||||
|
default = { };
|
||||||
|
defaultText = literalExpression "{ }";
|
||||||
|
example = literalExpression ''
|
||||||
|
{
|
||||||
|
servers = [
|
||||||
|
{
|
||||||
|
addr = "irc.libera.chat";
|
||||||
|
port = 6697;
|
||||||
|
tls = true;
|
||||||
|
realname = "John Doe";
|
||||||
|
nicks = [ "tinyuser" ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
defaults = {
|
||||||
|
nicks = [ "tinyuser" ];
|
||||||
|
realname = "John Doe";
|
||||||
|
join = [];
|
||||||
|
tls = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Configuration written to
|
||||||
|
<filename>$XDG_CONFIG_HOME/tiny/config.yml</filename>. See
|
||||||
|
<link xlink:href="https://github.com/osa1/tiny/blob/master/crates/tiny/config.yml"/>
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue