summary refs log tree commit diff stats
path: root/by-name-overlay.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--by-name-overlay.nix5
1 files changed, 5 insertions, 0 deletions
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
       ;
   };