@@ -1,43 +1,9 @@
1−{ stdenv, writeText, nix-user-chroot, nix, cacert, coreutils, bash }:
1+{ stdenv, writeText, nix-user-chroot, bash, makebootstrap }:
3−{ name, stage3 }:
3+{ name, target, run }:
6− stage1 = writeText "stage1.sh" ''
7− ./${nix-user-chroot}/bin/nix-user-chroot ./nix ./${bash}/bin/sh -c $(dirname $0)/stage2.sh
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"
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
23− nix-store --load-db < ./.reginfo
25− . ${nix.out}/etc/profile.d/nix.sh
27− nix-channel --add https://nixos.org/channels/nixpkgs-unstable
28− nix-channel --update nixpkgs
30− nix-shell --pure -p ${nix.out} --run "${stage3}"
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 ];
40− install -m 755 ${stage1} $out/stage1.sh
41− install -m 755 ${stage2} $out/stage2.sh