on master help sign in
Fix arx builds for bundles.
cfe7aefMatthew Bauer
arx.nix+1−1
@@ -9,7 +9,7 @@
9 inherit name;
9 inherit name;
10 nativeBuildInputs = [ arx ];
10 nativeBuildInputs = [ arx ];
11 buildCommand = ''
11 buildCommand = ''
12− ${arx}/bin/arx tmpx ${archive} -o $out -e ${startup}
12+ ${arx}/bin/arx tmpx ${archive} -o $out // ${startup}
13 chmod +x $out
13 chmod +x $out
14 '';
14 '';
15 }
15 }
default.nix+7−16
@@ -20,47 +20,38 @@ let
20 nix-user-chroot = callPackage ./nix-user-chroot.nix {};
20 nix-user-chroot = callPackage ./nix-user-chroot.nix {};
21
21
22 nix-bootstrap = callPackage ./nix-bootstrap.nix {
22 nix-bootstrap = callPackage ./nix-bootstrap.nix {
23− inherit nix-user-chroot;
23+ inherit nix-user-chroot makebootstrap;
24 };
24 };
25
25
26in {
26in {
27
27
28− helloBundle = makebootstrap {
28+ hello = nix-bootstrap {
29 name = "hello";
29 name = "hello";
30 target = hello;
30 target = hello;
31 run = "/bin/hello";
31 run = "/bin/hello";
32 };
32 };
33
33
34− firefoxBundle = makebootstrap {
34+ firefox = nix-bootstrap {
35 name = "firefox";
35 name = "firefox";
36 target = firefox;
36 target = firefox;
37 run = "/bin/firefox";
37 run = "/bin/firefox";
38 };
38 };
39
39
40− nanoBundle = makebootstrap {
40+ nano = nix-bootstrap {
41 name = "nano";
41 name = "nano";
42 target = nano;
42 target = nano;
43 run = "/bin/nano";
43 run = "/bin/nano";
44 };
44 };
45
45
46− emacsBundle = makebootstrap {
46+ emacs = nix-bootstrap {
47 name = "emacs";
47 name = "emacs";
48 target = emacs;
48 target = emacs;
49 run = "/bin/emacs";
49 run = "/bin/emacs";
50 };
50 };
51
51
52− nixShellBundle = makebootstrap {
53− name = "nix-bootstrap.sh";
54− target = nix-bootstrap {
55− name = "nix-bootstrap";
56− stage3 = "nix-shell --pure --packages bash --comand bash";
57− };
58− run = "/stage1.sh";
59− };
60−
61 nixInstaller = makebootstrap {
52 nixInstaller = makebootstrap {
62 name = "nix-installer.sh";
53 name = "nix-installer.sh";
63− target = nix-installer;
54+ targets = [ nix-installer ];
64− run = "/install";
55+ startup = ".${nix-installer}/install";
65 };
56 };
66}
57}
makebootstrap.nix+3−4
@@ -1,10 +1,9 @@
1{ arx, maketar }:
1{ arx, maketar }:
2
2
3− { name, target, run }:
3+ { name, targets, startup }:
4 arx {
4 arx {
5− inherit name;
5+ inherit name startup;
6− startup = "${target}${run}";
7 archive = maketar {
6 archive = maketar {
8− inherit name target;
7+ inherit name targets;
9 };
8 };
10 }
9 }
maketar.nix+5−5
@@ -1,17 +1,17 @@
1{ stdenv, perl, pathsFromGraph }:
1{ stdenv, perl, pathsFromGraph }:
2
2
3−{ name, target }:
3+{ name, targets }:
4
4
5 stdenv.mkDerivation {
5 stdenv.mkDerivation {
6 inherit name;
6 inherit name;
7− exportReferencesGraph = [ "closure" target ];
7+ exportReferencesGraph = map (x: [("closure-" + baseNameOf x) x]) targets;
8 nativeBuildInputs = [ perl ];
8 nativeBuildInputs = [ perl ];
9 buildCommand = ''
9 buildCommand = ''
10− storePaths=$(${perl}/bin/perl ${pathsFromGraph} ./closure)
10+ storePaths=$(${perl}/bin/perl ${pathsFromGraph} ./closure-* | grep -E -v '^/nix/store/[a-z0-9]+-(gcc|linux-headers)')
11− printRegistration=1 ${perl}/bin/perl ${pathsFromGraph} ./closure > .reginfo
11+ # printRegistration=1 ${perl}/bin/perl ${pathsFromGraph} ./closure-* > .reginfo
12 tar cvfj $out \
12 tar cvfj $out \
13 --owner=0 --group=0 --mode=u+rw,uga+r \
13 --owner=0 --group=0 --mode=u+rw,uga+r \
14 --hard-dereference \
14 --hard-dereference \
15− .reginfo $storePaths
15+ $storePaths
16 '';
16 '';
17 }
17 }
nix-bootstrap.nix+5−39
@@ -1,43 +1,9 @@
1−{ stdenv, writeText, nix-user-chroot, nix, cacert, coreutils, bash }:
1+{ stdenv, writeText, nix-user-chroot, bash, makebootstrap }:
2
2
3−{ name, stage3 }:
3+{ name, target, run }:
4
4
5−let
5+ makebootstrap {
6− stage1 = writeText "stage1.sh" ''
7− ./${nix-user-chroot}/bin/nix-user-chroot ./nix ./${bash}/bin/sh -c $(dirname $0)/stage2.sh
8− '';
9−
10− stage2 = writeText "stage2.sh" ''
11− unset NIX_REMOTE NIX_PROFILES NIX_USER_PROFILE_DIR NIX_OTHER_STORES NIX_PATH
12− export NIX_CONF_DIR=/nix/etc/nix/
13− export NIX_PROFILE=/nix/var/nix/profiles/default
14− export SSL_CERT_FILE="${cacert}/etc/ssl/certs/ca-bundle.crt"
15− export PATH="${coreutils}/bin:${bash}/bin:${nix.out}/bin"
16−
17− chmod -R a-w /nix/
18− chmod u+w /nix/ /nix/store/
19− mkdir -p /nix/etc/nix/ /nix/var/nix/profiles $HOME /bin/
20− ln -s ${bash}/bin/sh /bin/sh
21−
22− nix-store --init
23− nix-store --load-db < ./.reginfo
24−
25− . ${nix.out}/etc/profile.d/nix.sh
26−
27− nix-channel --add https://nixos.org/channels/nixpkgs-unstable
28− nix-channel --update nixpkgs
29−
30− nix-shell --pure -p ${nix.out} --run "${stage3}"
31− '';
32−
33−in
34−
35− stdenv.mkDerivation {
36 inherit name;
6 inherit name;
7+ startup = ".${nix-user-chroot}/bin/nix-user-chroot ./nix .${bash}/bin/sh -c ${target}${run}";
37− buildInputs = [ nix-user-chroot nix cacert ];
8+ targets = [ nix-user-chroot target bash ];
38− buildCommand = ''
39− mkdir -p $out
40− install -m 755 ${stage1} $out/stage1.sh
41− install -m 755 ${stage2} $out/stage2.sh
42− '';
43 }
9 }