@@ -1,17 +1,29 @@
1−{ stdenv, perl, pathsFromGraph }:
2−
1+{ stdenv, gcc, perl, pathsFromGraph }:
32{ name, targets }:
43
5− stdenv.mkDerivation {
6− inherit name;
7− exportReferencesGraph = map (x: [("closure-" + baseNameOf x) x]) targets;
8− nativeBuildInputs = [ perl ];
9− buildCommand = ''
10− storePaths=$(${perl}/bin/perl ${pathsFromGraph} ./closure-*)
11− # printRegistration=1 ${perl}/bin/perl ${pathsFromGraph} ./closure-* > .reginfo
12− tar cvfj $out \
13− --owner=0 --group=0 --mode=u+rw,uga+r \
14− --hard-dereference \
15− $storePaths
16− '';
17− }
4+stdenv.mkDerivation {
5+ inherit name;
6+ exportReferencesGraph = map (x: [("closure-" + baseNameOf x) x]) targets;
7+ nativeBuildInputs = [ perl ];
8+ buildCommand = ''
9+ storePaths=$(${perl}/bin/perl ${pathsFromGraph} ./closure-*)
10+
11+ # remove "unused" stdenv store paths
12+ # these need to be adjusted and made more intelligent
13+ # this should create a "runtime stdenv"
14+ storePaths=$(echo $storePaths | tr ' ' '\n' | \
15+ grep -Ev '/nix/store/[a-z0-9]+-linux-headers-[0-9.]+' | \
16+ grep -v ${stdenv.cc.libc.dev} | \
17+ grep -v ${stdenv.cc.libc.bin} | \
18+ grep -v ${stdenv.cc.cc} | \
19+ grep -v ${stdenv.cc.cc.lib} | \
20+ tr '\n' ' ')
21+ # grep -Ev '/nix/store/[a-z0-9]+-zlib-[0-9.]+' | \
22+
23+ # printRegistration=1 ${perl}/bin/perl ${pathsFromGraph} ./closure-* > .reginfo
24+ tar cfj $out \
25+ --owner=0 --group=0 --mode=u+rw,uga+r \
26+ --hard-dereference \
27+ $storePaths
28+ '';
29+}