diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-01-29 14:53:12 +0100 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-01-29 14:53:12 +0100 |
commit | e88bc695e82248c7283f9b8340965909837a3d1c (patch) | |
tree | 182d895fc90e9f155a4d6aee99f2041564626cfc /by-name-overlay.nix | |
parent | fix(by-name-overlay): Return absolute paths again (diff) | |
download | nix-library-e88bc695e82248c7283f9b8340965909837a3d1c.zip |
feat(by-name-overlay): Provide a toggle to return relative paths
Diffstat (limited to '')
-rw-r--r-- | by-name-overlay.nix | 5 |
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 ; }; |