on master help sign in
Fix arx builds for bundles.
commitcfe7aef52d55ae600d80fc20db26e5d0866c035a authorMatthew Bauer <mjbauer95@gmail.com> dateFri 17 Jun 2016, 18:39 (10 years ago) parent8be15d7
5 files changed+21−65
arx.nix+1−1 default.nix+7−16 makebootstrap.nix+3−4 maketar.nix+5−5 nix-bootstrap.nix+5−39
arx.nix+1−1
@@ -9,7 +9,7 @@
99 inherit name;
1010 nativeBuildInputs = [ arx ];
1111 buildCommand = ''
12− ${arx}/bin/arx tmpx ${archive} -o $out -e ${startup}
12+ ${arx}/bin/arx tmpx ${archive} -o $out // ${startup}
1313 chmod +x $out
1414 '';
1515 }
default.nix+7−16
@@ -20,47 +20,38 @@ let
2020 nix-user-chroot = callPackage ./nix-user-chroot.nix {};
2121
2222 nix-bootstrap = callPackage ./nix-bootstrap.nix {
23− inherit nix-user-chroot;
23+ inherit nix-user-chroot makebootstrap;
2424 };
2525
2626in {
2727
28− helloBundle = makebootstrap {
28+ hello = nix-bootstrap {
2929 name = "hello";
3030 target = hello;
3131 run = "/bin/hello";
3232 };
3333
34− firefoxBundle = makebootstrap {
34+ firefox = nix-bootstrap {
3535 name = "firefox";
3636 target = firefox;
3737 run = "/bin/firefox";
3838 };
3939
40− nanoBundle = makebootstrap {
40+ nano = nix-bootstrap {
4141 name = "nano";
4242 target = nano;
4343 run = "/bin/nano";
4444 };
4545
46− emacsBundle = makebootstrap {
46+ emacs = nix-bootstrap {
4747 name = "emacs";
4848 target = emacs;
4949 run = "/bin/emacs";
5050 };
5151
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−
6152 nixInstaller = makebootstrap {
6253 name = "nix-installer.sh";
63− target = nix-installer;
64− run = "/install";
54+ targets = [ nix-installer ];
55+ startup = ".${nix-installer}/install";
6556 };
6657}
makebootstrap.nix+3−4
@@ -1,10 +1,9 @@
11{ arx, maketar }:
22
3− { name, target, run }:
3+ { name, targets, startup }:
44 arx {
5− inherit name;
6− startup = "${target}${run}";
5+ inherit name startup;
76 archive = maketar {
8− inherit name target;
7+ inherit name targets;
98 };
109 }
maketar.nix+5−5
@@ -1,17 +1,17 @@
11{ stdenv, perl, pathsFromGraph }:
22
3−{ name, target }:
3+{ name, targets }:
44
55 stdenv.mkDerivation {
66 inherit name;
7− exportReferencesGraph = [ "closure" target ];
7+ exportReferencesGraph = map (x: [("closure-" + baseNameOf x) x]) targets;
88 nativeBuildInputs = [ perl ];
99 buildCommand = ''
10− storePaths=$(${perl}/bin/perl ${pathsFromGraph} ./closure)
11− printRegistration=1 ${perl}/bin/perl ${pathsFromGraph} ./closure > .reginfo
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
1212 tar cvfj $out \
1313 --owner=0 --group=0 --mode=u+rw,uga+r \
1414 --hard-dereference \
15− .reginfo $storePaths
15+ $storePaths
1616 '';
1717 }
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 }:
22
3−{ name, stage3 }:
3+{ name, target, run }:
44
5−let
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 {
5+ makebootstrap {
366 inherit name;
37− buildInputs = [ nix-user-chroot nix cacert ];
38− buildCommand = ''
39− mkdir -p $out
40− install -m 755 ${stage1} $out/stage1.sh
41− install -m 755 ${stage2} $out/stage2.sh
42− '';
7+ startup = ".${nix-user-chroot}/bin/nix-user-chroot ./nix .${bash}/bin/sh -c ${target}${run}";
8+ targets = [ nix-user-chroot target bash ];
439 }