Merge pull request #38629 from ivanbrennan/less-configFile
nixos/less: add configFile option
This commit is contained in:
commit
53611a9b6c
@ -6,7 +6,7 @@ let
|
|||||||
|
|
||||||
cfg = config.programs.less;
|
cfg = config.programs.less;
|
||||||
|
|
||||||
configFile = ''
|
configText = if (cfg.configFile != null) then (builtins.readFile cfg.configFile) else ''
|
||||||
#command
|
#command
|
||||||
${concatStringsSep "\n"
|
${concatStringsSep "\n"
|
||||||
(mapAttrsToList (command: action: "${command} ${action}") cfg.commands)
|
(mapAttrsToList (command: action: "${command} ${action}") cfg.commands)
|
||||||
@ -25,7 +25,7 @@ let
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
lessKey = pkgs.runCommand "lesskey"
|
lessKey = pkgs.runCommand "lesskey"
|
||||||
{ src = pkgs.writeText "lessconfig" configFile; }
|
{ src = pkgs.writeText "lessconfig" configText; }
|
||||||
"${pkgs.less}/bin/lesskey -o $out $src";
|
"${pkgs.less}/bin/lesskey -o $out $src";
|
||||||
|
|
||||||
in
|
in
|
||||||
@ -37,6 +37,19 @@ in
|
|||||||
|
|
||||||
enable = mkEnableOption "less";
|
enable = mkEnableOption "less";
|
||||||
|
|
||||||
|
configFile = mkOption {
|
||||||
|
type = types.nullOr types.path;
|
||||||
|
default = null;
|
||||||
|
example = literalExample "$${pkgs.my-configs}/lesskey";
|
||||||
|
description = ''
|
||||||
|
Path to lesskey configuration file.
|
||||||
|
|
||||||
|
<option>configFile</option> takes precedence over <option>commands</option>,
|
||||||
|
<option>clearDefaultCommands</option>, <option>lineEditingKeys</option>, and
|
||||||
|
<option>envVariables</option>.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
commands = mkOption {
|
commands = mkOption {
|
||||||
type = types.attrsOf types.str;
|
type = types.attrsOf types.str;
|
||||||
default = {};
|
default = {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user