mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 11:39:46 +01:00
less: allow customization
Signed-off-by: Pamplemousse <xav.maso@gmail.com>
This commit is contained in:
parent
7c320a5325
commit
f23073f1da
8 changed files with 78 additions and 0 deletions
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -113,6 +113,9 @@
|
|||
|
||||
/modules/programs/lazygit.nix @kalhauge
|
||||
|
||||
/modules/programs/less.nix @pamplemousse
|
||||
/tests/modules/programs/less @pamplemousse
|
||||
|
||||
/modules/programs/lesspipe.nix @rycee
|
||||
|
||||
/modules/programs/lf.nix @owm111
|
||||
|
|
|
@ -133,4 +133,11 @@
|
|||
github = "hawkw";
|
||||
githubId = 2796466;
|
||||
};
|
||||
|
||||
pamplemousse = {
|
||||
name = "Xavier Maso";
|
||||
email = "xav.maso@gmail.com";
|
||||
github = "pamplemousse";
|
||||
githubId = 2647236;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2252,6 +2252,13 @@ in
|
|||
'~/.taskrc'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2021-11-30T22:28:12+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.less'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ let
|
|||
./programs/keychain.nix
|
||||
./programs/kitty.nix
|
||||
./programs/lazygit.nix
|
||||
./programs/less.nix
|
||||
./programs/lesspipe.nix
|
||||
./programs/lf.nix
|
||||
./programs/lieer.nix
|
||||
|
|
32
modules/programs/less.nix
Normal file
32
modules/programs/less.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.programs.less;
|
||||
in {
|
||||
meta.maintainers = [ maintainers.pamplemousse ];
|
||||
|
||||
options = {
|
||||
programs.less = {
|
||||
enable = mkEnableOption "less, opposite of more";
|
||||
|
||||
keys = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = ''
|
||||
s back-line
|
||||
t forw-line
|
||||
'';
|
||||
description = ''
|
||||
Extra configuration for <command>less</command> written to
|
||||
<filename>$HOME/.lesskey</filename>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.less ];
|
||||
home.file.".lesskey".text = cfg.keys;
|
||||
};
|
||||
}
|
|
@ -66,6 +66,7 @@ import nmt {
|
|||
./modules/programs/irssi
|
||||
./modules/programs/kakoune
|
||||
./modules/programs/kitty
|
||||
./modules/programs/less
|
||||
./modules/programs/lf
|
||||
./modules/programs/lieer
|
||||
./modules/programs/man
|
||||
|
|
1
tests/modules/programs/less/default.nix
Normal file
1
tests/modules/programs/less/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ less-with-custom-keys = ./less-with-custom-keys.nix; }
|
26
tests/modules/programs/less/less-with-custom-keys.nix
Normal file
26
tests/modules/programs/less/less-with-custom-keys.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
programs.less = {
|
||||
enable = true;
|
||||
|
||||
keys = ''
|
||||
s back-line
|
||||
t forw-line
|
||||
'';
|
||||
};
|
||||
|
||||
test.stubs.less = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.lesskey
|
||||
assertFileContent home-files/.lesskey ${
|
||||
builtins.toFile "less.expected" ''
|
||||
s back-line
|
||||
t forw-line
|
||||
''
|
||||
}
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue