blob: 09674056d9cd8666ffe2fd6e38ec96dee0b3f0a9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
{
lib,
pkgsBuildBuild,
runCommand,
writeText,
source,
}:
{
pname,
path,
extraPaths ? [ ],
}:
let
sortedPaths = lib.naturalSort ([ path ] ++ extraPaths);
filterText = writeText "${pname}-src-include" (
lib.concatMapStringsSep "\n" (path: "/${path}") sortedPaths
);
in
runCommand "${pname}-filtered-src"
{
nativeBuildInputs = [
(pkgsBuildBuild.rsync.override {
enableZstd = false;
enableXXHash = false;
enableOpenSSL = false;
enableLZ4 = false;
})
];
}
''
rsync -a -r --files-from=${filterText} ${source}/ $out
''
|