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
, nixPrefix
, clusterName ? "mn4"
, extraMounts ? []
}:
with garlicTools;
with builtins;
let
slashM = map (line: "-m ${line}") extraMounts;
extraMountOptions = concatStringsSep "\n" slashM;
in
stdenv.mkDerivation {
name = "isolate";
preferLocalBuild = true;
@ -20,7 +26,7 @@ stdenv.mkDerivation {
src = ./.;
dontPatchShebangs = true;
programPath = "/bin/stage1";
inherit nixPrefix clusterName nixtools busybox;
inherit nixPrefix clusterName nixtools busybox extraMountOptions;
inherit nextStage;
program = stageProgram nextStage;
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 ^GARLIC || true)
$(env | grep ^USER || true)
$(env | grep ^TMPDIR || true)
HOME="/homeless-shelter"
)
@ -39,6 +40,7 @@ mounts=(
-m /gpfs/projects/bsc15
-m /gpfs/scratch/bsc15
-m /bin:@nixPrefix@@busybox@/bin
@extraMountOptions@
)
join_flags="${mounts[@]}"

View File

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