trippy: add module (#7426)
This commit is contained in:
parent
3978bcd696
commit
fab659b346
4 changed files with 100 additions and 0 deletions
57
modules/programs/trippy.nix
Normal file
57
modules/programs/trippy.nix
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
mkIf
|
||||
mkEnableOption
|
||||
mkPackageOption
|
||||
mkOption
|
||||
;
|
||||
|
||||
cfg = config.programs.trippy;
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
in
|
||||
{
|
||||
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
|
||||
|
||||
options.programs.trippy = {
|
||||
enable = mkEnableOption "trippy";
|
||||
package = mkPackageOption pkgs "trippy" { nullable = true; };
|
||||
settings = mkOption {
|
||||
type = tomlFormat.type;
|
||||
default = { };
|
||||
example = {
|
||||
theme-colors = {
|
||||
bg-color = "black";
|
||||
border-color = "gray";
|
||||
text-color = "gray";
|
||||
tab-text-color = "green";
|
||||
};
|
||||
bindings = {
|
||||
toggle-help = "h";
|
||||
toggle-help-alt = "?";
|
||||
toggle-settings = "s";
|
||||
toggle-settings-tui = "1";
|
||||
toggle-settings-trace = "2";
|
||||
toggle-settings-dns = "3";
|
||||
toggle-settings-geoip = "4";
|
||||
};
|
||||
};
|
||||
description = ''
|
||||
Configuration settings for trippy. All the available options can be found
|
||||
here: <https://trippy.rs/reference/configuration/>
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||
xdg.configFile."trippy/trippy.toml" = mkIf (cfg.settings != { }) {
|
||||
source = tomlFormat.generate "trippy-config" cfg.settings;
|
||||
};
|
||||
};
|
||||
}
|
||||
1
tests/modules/programs/trippy/default.nix
Normal file
1
tests/modules/programs/trippy/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ trippy-example = ./example-config.nix; }
|
||||
28
tests/modules/programs/trippy/example-config.nix
Normal file
28
tests/modules/programs/trippy/example-config.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
programs.trippy = {
|
||||
enable = true;
|
||||
settings = {
|
||||
theme-colors = {
|
||||
bg-color = "black";
|
||||
border-color = "gray";
|
||||
text-color = "gray";
|
||||
tab-text-color = "green";
|
||||
};
|
||||
bindings = {
|
||||
toggle-help = "h";
|
||||
toggle-help-alt = "?";
|
||||
toggle-settings = "s";
|
||||
toggle-settings-tui = "1";
|
||||
toggle-settings-trace = "2";
|
||||
toggle-settings-dns = "3";
|
||||
toggle-settings-geoip = "4";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/trippy/trippy.toml
|
||||
assertFileContent home-files/.config/trippy/trippy.toml \
|
||||
${./trippy.toml}
|
||||
'';
|
||||
}
|
||||
14
tests/modules/programs/trippy/trippy.toml
Normal file
14
tests/modules/programs/trippy/trippy.toml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[bindings]
|
||||
toggle-help = "h"
|
||||
toggle-help-alt = "?"
|
||||
toggle-settings = "s"
|
||||
toggle-settings-dns = "3"
|
||||
toggle-settings-geoip = "4"
|
||||
toggle-settings-trace = "2"
|
||||
toggle-settings-tui = "1"
|
||||
|
||||
[theme-colors]
|
||||
bg-color = "black"
|
||||
border-color = "gray"
|
||||
tab-text-color = "green"
|
||||
text-color = "gray"
|
||||
Loading…
Add table
Add a link
Reference in a new issue