stdexp: Allow extra mounts

This commit is contained in:
Rodrigo Arias 2020-11-20 15:30:47 +01:00
parent 2863ab6ae1
commit 734d494d96
3 changed files with 20 additions and 6 deletions

View File

@ -9,10 +9,16 @@
nextStage nextStage
, nixPrefix , nixPrefix
, clusterName ? "mn4" , clusterName ? "mn4"
, extraMounts ? []
}: }:
with garlicTools; with garlicTools;
with builtins;
let
slashM = map (line: "-m ${line}") extraMounts;
extraMountOptions = concatStringsSep "\n" slashM;
in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "isolate"; name = "isolate";
preferLocalBuild = true; preferLocalBuild = true;
@ -20,7 +26,7 @@ stdenv.mkDerivation {
src = ./.; src = ./.;
dontPatchShebangs = true; dontPatchShebangs = true;
programPath = "/bin/stage1"; programPath = "/bin/stage1";
inherit nixPrefix clusterName nixtools busybox; inherit nixPrefix clusterName nixtools busybox extraMountOptions;
inherit nextStage; inherit nextStage;
program = stageProgram nextStage; program = stageProgram nextStage;
desc = "# $out\n" + (if builtins.hasAttr "desc" nextStage then nextStage.desc else ""); desc = "# $out\n" + (if builtins.hasAttr "desc" nextStage then nextStage.desc else "");

View File

@ -19,6 +19,7 @@ env=(
$(env | grep ^PMI || true) $(env | grep ^PMI || true)
$(env | grep ^GARLIC || true) $(env | grep ^GARLIC || true)
$(env | grep ^USER || true) $(env | grep ^USER || true)
$(env | grep ^TMPDIR || true)
HOME="/homeless-shelter" HOME="/homeless-shelter"
) )
@ -39,6 +40,7 @@ mounts=(
-m /gpfs/projects/bsc15 -m /gpfs/projects/bsc15
-m /gpfs/scratch/bsc15 -m /gpfs/scratch/bsc15
-m /bin:@nixPrefix@@busybox@/bin -m /bin:@nixPrefix@@busybox@/bin
@extraMountOptions@
) )
join_flags="${mounts[@]}" join_flags="${mounts[@]}"

View File

@ -75,11 +75,17 @@ rec {
} }
); );
isolate = {nextStage, conf, ...}: stages.isolate { isolate = {nextStage, conf, ...}: stages.isolate (
clusterName = machineConf.name; (
inherit (conf) nixPrefix; if (conf ? extraMounts) then { inherit (conf) extraMounts; }
inherit nextStage; else {}
}; ) //
{
clusterName = machineConf.name;
inherit (conf) nixPrefix;
inherit nextStage;
}
);
}; };
stdPipelineOverride = {overrides ? {}}: stdPipelineOverride = {overrides ? {}}: