@@ -3,32 +3,64 @@
33with nixpkgs;
44
55rec {
6+ arx = { archive, startup}:
7+ stdenv.mkDerivation {
8+ name = "arx";
9+ buildCommand = ''
10+ ${haskellPackages.arx}/bin/arx tmpx ${archive} -o $out // ${startup}
11+ chmod +x $out
12+ '';
13+ };
614
7− arx = callPackage ./arx.nix {
8− inherit (haskellPackages) arx;
9− };
10−
11− maketar = callPackage ./maketar.nix {};
12−
13− nix-installer = callPackage ./nix-installer.nix {};
15+ maketar = { targets }:
16+ stdenv.mkDerivation {
17+ name = "maketar";
18+ exportReferencesGraph = map (x: [("closure-" + baseNameOf x) x]) targets;
19+ buildCommand = ''
20+ storePaths=$(${perl}/bin/perl ${pathsFromGraph} ./closure-*)
1421
15− makebootstrap = callPackage ./makebootstrap.nix {
16− inherit arx maketar;
17− };
18−
19− nix-user-chroot = callPackage ./nix-user-chroot.nix {};
22+ # printRegistration=1 ${perl}/bin/perl ${pathsFromGraph} ./closure-* > .reginfo
23+ tar cfj $out \
24+ --owner=0 --group=0 --mode=u+rw,uga+r \
25+ --hard-dereference \
26+ $storePaths
27+ '';
28+ };
2029
21− nix-bootstrap = callPackage ./nix-bootstrap.nix {
22− inherit nix-user-chroot makebootstrap;
23− };
30+ nix-user-chroot = stdenv.mkDerivation {
31+ name = "nix-user-chroot-2b144e";
32+ src = fetchFromGitHub {
33+ owner = "matthewbauer";
34+ repo = "nix-user-chroot";
35+ rev = "2b144ee89568ba40b66317da261ce889fbda3674";
36+ sha256 = "16bmshhvk6941w04rx78i5a1305876qni2n2rvm7rkziz49j158n";
37+ };
2438
25− appimagetool = callPackage ./appimagetool.nix {};
39+ postFixup = ''
40+ exe=$out/bin/nix-user-chroot
41+ patchelf \
42+ --set-interpreter .$(patchelf --print-interpreter $exe) \
43+ --set-rpath $(patchelf --print-rpath $exe | sed 's|/nix/store/|./nix/store/|g') \
44+ $exe
45+ '';
2646
27− appimage = callPackage ./appimage.nix {
28− inherit appimagetool;
47+ installPhase = ''
48+ mkdir -p $out/bin/
49+ cp nix-user-chroot $out/bin/nix-user-chroot
50+ '';
2951 };
3052
31− appdir = callPackage ./appdir.nix {};
53+ makebootstrap = { targets, startup }:
54+ arx {
55+ inherit startup;
56+ archive = maketar {
57+ inherit targets;
58+ };
59+ };
3260
33− closure = callPackage ./closure.nix {};
61+ nix-bootstrap = { target, run }:
62+ makebootstrap {
63+ startup = ".${nix-user-chroot}/bin/nix-user-chroot ./nix ${target}${run}";
64+ targets = [ nix-user-chroot target ];
65+ };
3466}