Working isolated environment

This commit is contained in:
Rodrigo Arias Mallo 2020-10-05 19:13:02 +02:00
parent 2a01ee7f24
commit effcc2d20b
4 changed files with 26 additions and 8 deletions

View File

@ -112,10 +112,6 @@ let
argv = {stage, conf, ...}: w.argv {
program = stageProgram stage;
env = ''
set -e
export I_MPI_THREAD_SPLIT=1
'';
argv = ''( -t ${toString conf.timesteps}
-p ${toString conf.particles} )'';
};

View File

@ -2,6 +2,7 @@
stdenv
, nixtools
, busybox
, strace
}:
{
@ -14,15 +15,24 @@ stdenv.mkDerivation {
name = "isolate";
preferLocalBuild = true;
phases = [ "unpackPhase" "installPhase" ];
buildInputs = [
#nixtools
#strace
];
src = ./.;
dontPatchShebangs = true;
programPath = "/bin/stage1";
inherit program nixPrefix clusterName nixtools busybox;
out = "$out";
installPhase = ''
echo PATH=$PATH
substituteAllInPlace stage1
substituteAllInPlace stage2
sed -i "s|@extraPath@|$PATH|g" stage1
mkdir -p $out/bin
cp stage* $out/bin/
chmod +x $out/bin/stage*

View File

@ -1,4 +1,4 @@
#!/bin/sh -ex
#!/bin/bash -ex
>&2 echo Running isolate stage1
>&2 echo PATH=$PATH
@ -13,11 +13,19 @@ shell="@busybox@/bin/sh"
nixjoin="@nixPrefix@@nixtools@/bin/nix-join"
env=(
PATH="@nixPrefix@@busybox@/bin:@busybox@/bin:@extraPath@"
$(env | grep ^SLURM || true)
$(env | grep ^GARLIC_OUT || true)
)
#-m @nixPrefix@ \
join_flags="
-m /etc \
join_flags="-m /etc \
-m /.statelite/tmpfs/etc \
-m /sys \
-m /var/run/munge \
-m /gpfs/projects/bsc15 \
-m /bin:@nixPrefix@@busybox@/bin"
exec $nixjoin -i $join_flags $nixhome -- @out@/bin/stage2
exec $nixjoin -v -i $join_flags $nixhome -- \
env -i "${env[@]}" @out@/bin/stage2

View File

@ -131,6 +131,10 @@ let
mpptest = callPackage ./bsc/mpptest/default.nix { };
busybox = self.busybox.override {
enableStatic = true;
};
nixtools = callPackage ./bsc/nixtools/default.nix {
targetCluster = "mn4";
nixPrefix = "/gpfs/projects/bsc15/nix";