From d4920889d623b535c1614f42efdf47b5a412165d Mon Sep 17 00:00:00 2001 From: Quinn Unger Date: Fri, 17 Jul 2026 15:56:37 +0100 Subject: [PATCH] fix legacy core name parsing (#28) --- lib/fusesocLib.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/fusesocLib.nix b/lib/fusesocLib.nix index deef46c..c7bc9d2 100644 --- a/lib/fusesocLib.nix +++ b/lib/fusesocLib.nix @@ -46,9 +46,19 @@ rec { version = noVersion; } else + let + dropIfMatch = + regex: list: + if (isNull (builtins.match regex (lib.last list))) then list else (lib.dropEnd 1 list); + dropRevision = dropIfMatch "^r[[:digit:]]+$"; + dropVersion = list: if (builtins.length list > 1) then (dropIfMatch ''^[\.0-9]+$'' list) else list; + trimmed = dropVersion (dropRevision legacySplit); + dropAmt = (builtins.length legacySplit) - (builtins.length trimmed); + in { - name = builtins.head legacySplit; - version = lib.concatStringsSep "-" (builtins.tail legacySplit); + name = lib.concatStringsSep "-" trimmed; + version = + if dropAmt == 0 then noVersion else (lib.concatStringsSep "-" (lib.takeEnd dropAmt legacySplit)); } ) -- 2.51.2