From e88bc695e82248c7283f9b8340965909837a3d1c Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Wed, 29 Jan 2025 14:53:12 +0100 Subject: feat(by-name-overlay): Provide a toggle to return relative paths --- by-name-overlay.nix | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'by-name-overlay.nix') diff --git a/by-name-overlay.nix b/by-name-overlay.nix index c36a6ca..c578861 100644 --- a/by-name-overlay.nix +++ b/by-name-overlay.nix @@ -16,6 +16,7 @@ fileRegex ? null, finalizeFunction ? name: value: value, useShards ? true, + relativePaths ? false, }: assert fileName == null -> fileRegex != null; assert fileRegex == null -> fileName != null; let @@ -57,6 +58,7 @@ assert fileRegex == null -> fileName != null; let fileDisplay, finalizeFunction, useShards, + relativePaths, }: let # Takes a list of attrs as input and returns one merged attr set. flattenAttrs = list: @@ -97,6 +99,8 @@ assert fileRegex == null -> fileName != null; let then # The `namesForShard` function should have already printed a warning. [null] + else if relativePaths + then pathSegment else path else warn "'${builtins.toString path}' does not exist. Skipped" null; in @@ -129,6 +133,7 @@ assert fileRegex == null -> fileName != null; let fileDisplay finalizeFunction useShards + relativePaths ; }; -- cgit 1.4.1