Working isolated environment

This commit is contained in:
Rodrigo Arias 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 { argv = {stage, conf, ...}: w.argv {
program = stageProgram stage; program = stageProgram stage;
env = ''
set -e
export I_MPI_THREAD_SPLIT=1
'';
argv = ''( -t ${toString conf.timesteps} argv = ''( -t ${toString conf.timesteps}
-p ${toString conf.particles} )''; -p ${toString conf.particles} )'';
}; };

View File

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

View File

@ -1,4 +1,4 @@
#!/bin/sh -ex #!/bin/bash -ex
>&2 echo Running isolate stage1 >&2 echo Running isolate stage1
>&2 echo PATH=$PATH >&2 echo PATH=$PATH
@ -13,11 +13,19 @@ shell="@busybox@/bin/sh"
nixjoin="@nixPrefix@@nixtools@/bin/nix-join" 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@ \ #-m @nixPrefix@ \
join_flags=" join_flags="-m /etc \
-m /etc \ -m /.statelite/tmpfs/etc \
-m /sys \
-m /var/run/munge \ -m /var/run/munge \
-m /gpfs/projects/bsc15 \ -m /gpfs/projects/bsc15 \
-m /bin:@nixPrefix@@busybox@/bin" -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 { }; mpptest = callPackage ./bsc/mpptest/default.nix { };
busybox = self.busybox.override {
enableStatic = true;
};
nixtools = callPackage ./bsc/nixtools/default.nix { nixtools = callPackage ./bsc/nixtools/default.nix {
targetCluster = "mn4"; targetCluster = "mn4";
nixPrefix = "/gpfs/projects/bsc15/nix"; nixPrefix = "/gpfs/projects/bsc15/nix";