1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

visidata: add module (#6956)

This commit is contained in:
Aguirre Matteo 2025-05-02 16:14:19 +00:00 committed by GitHub
parent 355a6b937d
commit d6b0c05457
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 84 additions and 0 deletions

View file

@ -295,6 +295,7 @@ let
./programs/vinegar.nix
./programs/vscode.nix
./programs/vscode/haskell.nix
./programs/visidata.nix
./programs/pywal.nix
./programs/rbenv.nix
./programs/wallust.nix

View file

@ -0,0 +1,50 @@
{
lib,
pkgs,
config,
...
}:
let
inherit (lib)
types
mkIf
mkEnableOption
mkPackageOption
mkOption
;
cfg = config.programs.visidata;
in
{
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
options.programs.visidata = {
enable = mkEnableOption "Visidata";
package = mkPackageOption pkgs "visidata" { nullable = true; };
visidatarc = mkOption {
type = types.lines;
default = "";
example = ''
options.min_memory_mb=100 # stop processing without 100MB free
bindkey('0', 'go-leftmost') # alias '0' to go to first column, like vim
def median(values):
L = sorted(values)
return L[len(L)//2]
vd.aggregator('median', median)
'';
description = ''
Configuration settings and Python function declarations
to be written to ~/.visidatarc. All available options
can be found here: <https://www.visidata.org/docs/>.
'';
};
};
config = mkIf cfg.enable {
home.packages = mkIf (cfg.package != null) [ cfg.package ];
home.file.".visidatarc" = mkIf (cfg.visidatarc != "") { text = cfg.visidatarc; };
};
}

View file

@ -309,6 +309,7 @@ import nmtSrc {
./modules/programs/uv
./modules/programs/vifm
./modules/programs/vim-vint
./modules/programs/visidata
./modules/programs/vscode
./modules/programs/wallust
./modules/programs/watson

View file

@ -0,0 +1,9 @@
options.min_memory_mb=100
bindkey('0', 'go-leftmost')
def median(values):
L = sorted(values)
return L[len(L)//2]
vd.aggregator('median', median)

View file

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

View file

@ -0,0 +1,22 @@
{
programs.visidata = {
enable = true;
visidatarc = ''
options.min_memory_mb=100
bindkey('0', 'go-leftmost')
def median(values):
L = sorted(values)
return L[len(L)//2]
vd.aggregator('median', median)
'';
};
nmt.script = ''
assertFileExists home-files/.visidatarc
assertFileContent home-files/.visidatarc \
${./config}
'';
}