From 8d162ec7b8c87525af611f163e424ea9b09f7fa0 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Mon, 27 Nov 2023 12:28:52 +1300 Subject: [PATCH] lib.customisation: Don't allocate intermediate list for missing args --- lib/customisation.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/customisation.nix b/lib/customisation.nix index 87d08c32765b..dec1ab9f4faa 100644 --- a/lib/customisation.nix +++ b/lib/customisation.nix @@ -160,7 +160,7 @@ rec { # a list of argument names that the function requires, but # wouldn't be passed to it - missingArgs = attrNames + missingArgs = # Filter out arguments that have a default value (filterAttrs (name: value: ! value) # Filter out arguments that would be passed @@ -198,9 +198,9 @@ rec { + "${loc'}${prettySuggestions (getSuggestions arg)}"; # Only show the error for the first missing argument - error = errorForArg (head missingArgs); + error = errorForArg missingArgs.${head (attrNames missingArgs)}; - in if missingArgs == [] then makeOverridable f allArgs else abort error; + in if missingArgs == {} then makeOverridable f allArgs else abort error; /* Like callPackage, but for a function that returns an attribute