1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
{ filterin }:

with import ./config.nix;

mkDerivation {
  name = "filter";
  builder = builtins.toFile "builder" "ln -s $input $out";
  input =
    let filter = path: type:
      type != "symlink"
      && (builtins.substring 0 (builtins.stringLength filterin) (builtins.toString path) == filterin)
      && baseNameOf path != "foo"
      && !(hasSuffix ".bak" (baseNameOf path));
    in builtins.filterSource filter filterin;
}