11 lines
335 B
Nix
11 lines
335 B
Nix
# `pathsWithin dir paths`: the entries of `paths` that sit under `dir`, relative
|
|
# to it. A null entry, and a path elsewhere (or `dir` itself), is left out.
|
|
{ lib }:
|
|
dir: paths:
|
|
lib.concatMap (
|
|
path:
|
|
let
|
|
prefix = "${dir}/";
|
|
in
|
|
lib.optional (path != null && lib.hasPrefix prefix path) (lib.removePrefix prefix path)
|
|
) paths
|