summaryrefslogtreecommitdiffstats
path: root/krebs/4lib/infest/prepare.sh
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2016-02-22 01:08:46 +0100
committerlassulus <lass@aidsballs.de>2016-02-22 01:08:46 +0100
commit020fcc22000ce35337a765bfa37f4178fbbff68c (patch)
tree8485531b5285b4dce6e9b9abecba4ccad5b9b46a /krebs/4lib/infest/prepare.sh
parent2924afb8a2cb7d734b56a4a8934737129a20154c (diff)
parenta2b8eb75506fa27bc3d44f6a33d860ce7d3470e0 (diff)
Merge remote-tracking branch 'cd/master'
Diffstat (limited to 'krebs/4lib/infest/prepare.sh')
-rw-r--r--krebs/4lib/infest/prepare.sh33
1 files changed, 14 insertions, 19 deletions
diff --git a/krebs/4lib/infest/prepare.sh b/krebs/4lib/infest/prepare.sh
index b3824c7d4..a217e7bed 100644
--- a/krebs/4lib/infest/prepare.sh
+++ b/krebs/4lib/infest/prepare.sh
@@ -184,26 +184,21 @@ prepare_common() {(
. /root/.nix-profile/etc/profile.d/nix.sh
- for i in \
- bash \
- coreutils \
- # This line intentionally left blank.
- do
- if ! nix-env -q $i | grep -q .; then
- nix-env -iA nixpkgs.pkgs.$i
- fi
- done
+ mkdir -p /mnt/"$target_path"
+ mkdir -p "$target_path"
+
+ if ! mountpoint "$target_path"; then
+ mount --rbind /mnt/"$target_path" "$target_path"
+ fi
+
+ mkdir -p bin
+ rm -f bin/nixos-install
+ cp "$(type -p nixos-install)" bin/nixos-install
+ sed -i "s@^NIX_PATH=\"[^\"]*\"@NIX_PATH=$target_path@" bin/nixos-install
- # install nixos-install
- if ! type nixos-install 2>/dev/null; then
- nixpkgs_expr='import <nixpkgs> { system = builtins.currentSystem; }'
- nixpkgs_path=$(find /nix/store -mindepth 1 -maxdepth 1 -name *-nixpkgs-* -type d)
- nix-env \
- --arg config "{ nix.package = ($nixpkgs_expr).nix; }" \
- --arg pkgs "$nixpkgs_expr" \
- --arg modulesPath 'throw "no modulesPath"' \
- -f $nixpkgs_path/nixpkgs/nixos/modules/installer/tools/tools.nix \
- -iA config.system.build.nixos-install
+ if ! grep -q '^PATH.*#krebs' .bashrc; then
+ echo '. /root/.nix-profile/etc/profile.d/nix.sh' >> .bashrc
+ echo 'PATH=$HOME/bin:$PATH #krebs' >> .bashrc
fi
)}