From 08e8701673a84b800e0960c50f78793a23e635ba Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Sat, 24 Mar 2018 17:38:45 +0100 Subject: [PATCH] lib.types: fix loaOf behavior for long lists Assigning a list of 10 or more elements to an option having the type `loaOf a` produces a configuration value that is not honoring the order of the original list. This commit fixes this and a related issue arising when 10 or more lists are merged into this type of option. --- lib/tests/modules.sh | 6 ++++ lib/tests/modules/loaOf-with-long-list.nix | 19 ++++++++++++ .../modules/loaOf-with-many-list-merges.nix | 19 ++++++++++++ lib/types.nix | 29 +++++++++++++------ 4 files changed, 64 insertions(+), 9 deletions(-) create mode 100644 lib/tests/modules/loaOf-with-long-list.nix create mode 100644 lib/tests/modules/loaOf-with-many-list-merges.nix diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index c6b3fd912a9..b83e1eb7d82 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -143,6 +143,12 @@ checkConfigOutput "12" config.value ./declare-coerced-value-unsound.nix checkConfigError 'The option value .* in .* is not.*8 bit signed integer.* or string convertible to it' config.value ./declare-coerced-value-unsound.nix ./define-value-string-bigint.nix checkConfigError 'unrecognised JSON value' config.value ./declare-coerced-value-unsound.nix ./define-value-string-arbitrary.nix +# Check loaOf with long list. +checkConfigOutput "1 2 3 4 5 6 7 8 9 10" config.result ./loaOf-with-long-list.nix + +# Check loaOf with many merges of lists. +checkConfigOutput "1 2 3 4 5 6 7 8 9 10" config.result ./loaOf-with-many-list-merges.nix + cat <"]); getSubModules = elemType.getSubModules; substSubModules = m: loaOf (elemType.substSubModules m);