From 07d79726f172d15b796cd81433acdde1c7577aa0 Mon Sep 17 00:00:00 2001 From: Benedikt Rips Date: Sun, 23 Nov 2025 15:17:49 +0100 Subject: [PATCH] less: enable options to be specified multiple times --- modules/programs/less.nix | 13 ++++++++----- .../programs/less/custom-options-and-config.nix | 7 +++++-- tests/modules/programs/less/custom-options.nix | 7 +++++-- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/modules/programs/less.nix b/modules/programs/less.nix index 1a8c5fb77..c9296928c 100644 --- a/modules/programs/less.nix +++ b/modules/programs/less.nix @@ -37,11 +37,14 @@ in options = lib.mkOption { type = with lib.types; - attrsOf (oneOf [ - bool - int - str - ]); + let + scalar = oneOf [ + bool + int + str + ]; + in + attrsOf (either scalar (listOf scalar)); default = { }; description = "GNU-style options to be set via {env}`$LESS`."; example = { diff --git a/tests/modules/programs/less/custom-options-and-config.nix b/tests/modules/programs/less/custom-options-and-config.nix index 421a55cd2..787c8473a 100644 --- a/tests/modules/programs/less/custom-options-and-config.nix +++ b/tests/modules/programs/less/custom-options-and-config.nix @@ -12,7 +12,10 @@ in options = { RAW-CONTROL-CHARS = true; quiet = true; - wheel-lines = 3; + wheel-lines = [ + 3 + 1 + ]; }; }; @@ -20,7 +23,7 @@ in assertFileExists home-files/.config/lesskey assertFileContent home-files/.config/lesskey ${builtins.toFile "less.expected" '' #env - LESS = --RAW-CONTROL-CHARS --quiet --wheel-lines 3 + LESS = --RAW-CONTROL-CHARS --quiet --wheel-lines 3 --wheel-lines 1 ${config}''} ''; diff --git a/tests/modules/programs/less/custom-options.nix b/tests/modules/programs/less/custom-options.nix index 2e97f7d68..81abfd963 100644 --- a/tests/modules/programs/less/custom-options.nix +++ b/tests/modules/programs/less/custom-options.nix @@ -4,7 +4,10 @@ options = { RAW-CONTROL-CHARS = true; quiet = true; - wheel-lines = 3; + wheel-lines = [ + 3 + 1 + ]; }; }; @@ -12,7 +15,7 @@ assertFileExists home-files/.config/lesskey assertFileContent home-files/.config/lesskey ${builtins.toFile "lesskey.expected" '' #env - LESS = --RAW-CONTROL-CHARS --quiet --wheel-lines 3 + LESS = --RAW-CONTROL-CHARS --quiet --wheel-lines 3 --wheel-lines 1 ''} ''; }