mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-01 14:41:03 +01:00
less: rename keys to config
This commit is contained in:
parent
9a132f2971
commit
dfcea0573d
4 changed files with 17 additions and 14 deletions
|
|
@ -10,13 +10,17 @@ in
|
|||
{
|
||||
meta.maintainers = [ lib.maintainers.pamplemousse ];
|
||||
|
||||
imports = [
|
||||
(lib.mkRenamedOptionModule [ "programs" "less" "keys" ] [ "programs" "less" "config" ])
|
||||
];
|
||||
|
||||
options = {
|
||||
programs.less = {
|
||||
enable = lib.mkEnableOption "less, opposite of more";
|
||||
|
||||
package = lib.mkPackageOption pkgs "less" { nullable = true; };
|
||||
|
||||
keys = lib.mkOption {
|
||||
config = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
example = ''
|
||||
|
|
@ -24,7 +28,7 @@ in
|
|||
t forw-line
|
||||
'';
|
||||
description = ''
|
||||
Extra configuration for {command}`less` written to
|
||||
Configuration for {command}`less`, written to
|
||||
{file}`$XDG_CONFIG_HOME/lesskey`.
|
||||
'';
|
||||
};
|
||||
|
|
@ -34,6 +38,6 @@ in
|
|||
config = lib.mkIf cfg.enable {
|
||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
|
||||
xdg.configFile."lesskey" = lib.mkIf (cfg.keys != "") { text = cfg.keys; };
|
||||
xdg.configFile."lesskey" = lib.mkIf (cfg.config != "") { text = cfg.config; };
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,17 @@
|
|||
{
|
||||
programs.less = {
|
||||
enable = true;
|
||||
|
||||
keys = ''
|
||||
let
|
||||
config = ''
|
||||
s back-line
|
||||
t forw-line
|
||||
'';
|
||||
in
|
||||
{
|
||||
programs.less = {
|
||||
enable = true;
|
||||
inherit config;
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/lesskey
|
||||
assertFileContent home-files/.config/lesskey ${builtins.toFile "less.expected" ''
|
||||
s back-line
|
||||
t forw-line
|
||||
''}
|
||||
assertFileContent home-files/.config/lesskey ${builtins.toFile "less.expected" config}
|
||||
'';
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
less-custom-keys = ./custom-keys.nix;
|
||||
less-no-keys = ./no-keys.nix;
|
||||
less-custom-config = ./custom-config.nix;
|
||||
less-no-config = ./no-config.nix;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue