From 6403eb8f4bcb54bd4411e4e2736b279072034e92 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Mon, 3 Mar 2025 00:03:21 +0100 Subject: [PATCH] _experimental-update-script-combinators.sequence: Loosen attrPath constraint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We only allow a single value for `attrPath` across all sequenced update scripts. But previously `null` (representing `passthru.updateScript.attrPath` not being defined) was counted as one value. This would prevent us from explicitly specifying `attrPath` in `gnome.updateScript` in the next commit. Let’s ignore update scripts without specified `attrPath` attribute for the purpose of this check. --- pkgs/common-updater/combinators.nix | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pkgs/common-updater/combinators.nix b/pkgs/common-updater/combinators.nix index c4754848be87..eafc530ceaed 100644 --- a/pkgs/common-updater/combinators.nix +++ b/pkgs/common-updater/combinators.nix @@ -169,18 +169,21 @@ rec { assert lib.assertMsg (lib.all validateFeatures scripts) "Combining update scripts with features enabled (other than “silent” scripts and an optional single script with “commit”) is currently unsupported."; + assert lib.assertMsg ( builtins.length ( lib.unique ( - builtins.map ( - { - attrPath ? null, - ... - }: - attrPath - ) scripts + builtins.filter (attrPath: attrPath != null) ( + builtins.map ( + { + attrPath ? null, + ... + }: + attrPath + ) scripts + ) ) - ) == 1 + ) <= 1 ) "Combining update scripts with different attr paths is currently unsupported."; {