1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +01:00

less: allow customization

Signed-off-by: Pamplemousse <xav.maso@gmail.com>
This commit is contained in:
Pamplemousse 2021-11-11 11:32:48 +01:00 committed by Robert Helgesson
parent 7c320a5325
commit f23073f1da
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
8 changed files with 78 additions and 0 deletions

3
.github/CODEOWNERS vendored
View file

@ -113,6 +113,9 @@
/modules/programs/lazygit.nix @kalhauge /modules/programs/lazygit.nix @kalhauge
/modules/programs/less.nix @pamplemousse
/tests/modules/programs/less @pamplemousse
/modules/programs/lesspipe.nix @rycee /modules/programs/lesspipe.nix @rycee
/modules/programs/lf.nix @owm111 /modules/programs/lf.nix @owm111

View file

@ -133,4 +133,11 @@
github = "hawkw"; github = "hawkw";
githubId = 2796466; githubId = 2796466;
}; };
pamplemousse = {
name = "Xavier Maso";
email = "xav.maso@gmail.com";
github = "pamplemousse";
githubId = 2647236;
};
} }

View file

@ -2252,6 +2252,13 @@ in
'~/.taskrc'. '~/.taskrc'.
''; '';
} }
{
time = "2021-11-30T22:28:12+00:00";
message = ''
A new module is available: 'programs.less'.
'';
}
]; ];
}; };
} }

View file

@ -86,6 +86,7 @@ let
./programs/keychain.nix ./programs/keychain.nix
./programs/kitty.nix ./programs/kitty.nix
./programs/lazygit.nix ./programs/lazygit.nix
./programs/less.nix
./programs/lesspipe.nix ./programs/lesspipe.nix
./programs/lf.nix ./programs/lf.nix
./programs/lieer.nix ./programs/lieer.nix

32
modules/programs/less.nix Normal file
View 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;
};
}

View file

@ -66,6 +66,7 @@ import nmt {
./modules/programs/irssi ./modules/programs/irssi
./modules/programs/kakoune ./modules/programs/kakoune
./modules/programs/kitty ./modules/programs/kitty
./modules/programs/less
./modules/programs/lf ./modules/programs/lf
./modules/programs/lieer ./modules/programs/lieer
./modules/programs/man ./modules/programs/man

View file

@ -0,0 +1 @@
{ less-with-custom-keys = ./less-with-custom-keys.nix; }

View 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
''
}
'';
}