Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/nix/host-modules/lib/paths-within.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