diff --git a/nixos/modules/programs/less.nix b/nixos/modules/programs/less.nix
index c0283c9e686..d39103a5805 100644
--- a/nixos/modules/programs/less.nix
+++ b/nixos/modules/programs/less.nix
@@ -6,7 +6,7 @@ let
cfg = config.programs.less;
- configFile = ''
+ configText = if (cfg.configFile != null) then (builtins.readFile cfg.configFile) else ''
#command
${concatStringsSep "\n"
(mapAttrsToList (command: action: "${command} ${action}") cfg.commands)
@@ -25,7 +25,7 @@ let
'';
lessKey = pkgs.runCommand "lesskey"
- { src = pkgs.writeText "lessconfig" configFile; }
+ { src = pkgs.writeText "lessconfig" configText; }
"${pkgs.less}/bin/lesskey -o $out $src";
in
@@ -37,6 +37,19 @@ in
enable = mkEnableOption "less";
+ configFile = mkOption {
+ type = types.nullOr types.path;
+ default = null;
+ example = literalExample "$${pkgs.my-configs}/lesskey";
+ description = ''
+ Path to lesskey configuration file.
+
+ takes precedence over ,
+ , , and
+ .
+ '';
+ };
+
commands = mkOption {
type = types.attrsOf types.str;
default = {};