lesspipe: allow configuring package

This commit is contained in:
Kiara Grouwstra 2024-12-27 18:39:49 +01:00 committed by Robert Helgesson
parent 35b98d20ca
commit 19398e505a
Failed to generate hash of commit
4 changed files with 21 additions and 3 deletions

View file

@ -2,18 +2,24 @@
with lib;
{
let
cfg = config.programs.lesspipe;
in {
meta.maintainers = [ maintainers.rycee ];
options = {
programs.lesspipe = {
enable = mkEnableOption "lesspipe preprocessor for less";
package = mkPackageOption pkgs "lesspipe" { };
};
};
config = mkIf config.programs.lesspipe.enable {
config = mkIf cfg.enable {
home.sessionVariables = {
LESSOPEN = "|${pkgs.lesspipe}/bin/lesspipe.sh %s";
LESSOPEN = "|${cfg.package}/bin/lesspipe.sh %s";
};
};
}

View file

@ -101,6 +101,7 @@ in import nmtSrc {
./modules/programs/kubecolor
./modules/programs/ledger
./modules/programs/less
./modules/programs/lesspipe
./modules/programs/lf
./modules/programs/lsd
./modules/programs/lieer

View file

@ -0,0 +1 @@
{ lesspipe = ./lesspipe.nix; }

View file

@ -0,0 +1,10 @@
{
programs.lesspipe.enable = true;
test.stubs.lesspipe = { };
nmt.script = ''
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
'export LESSOPEN="|@lesspipe@/bin/lesspipe.sh %s"'
'';
}