Add control and nix-setup layers
This commit is contained in:
parent
ef1aeb2cfa
commit
338736d257
23
bsc/garlic/control.nix
Normal file
23
bsc/garlic/control.nix
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
stdenv
|
||||
}:
|
||||
|
||||
program:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
inherit program;
|
||||
name = "${program.name}-control";
|
||||
preferLocalBuild = true;
|
||||
phases = [ "installPhase" ];
|
||||
dontPatchShebangs = true;
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cat > $out/bin/run <<EOF
|
||||
#!/bin/sh
|
||||
for n in {1..30}; do
|
||||
$program/bin/run
|
||||
done
|
||||
EOF
|
||||
chmod +x $out/bin/run
|
||||
'';
|
||||
}
|
@ -25,6 +25,8 @@ let
|
||||
|
||||
sbatch = callPackage ./sbatch.nix { };
|
||||
launcher = callPackage ./launcher.nix { };
|
||||
control = callPackage ./control.nix { };
|
||||
nixsetup = callPackage ./nix-setup.nix { };
|
||||
|
||||
exp = {
|
||||
nbody = {
|
||||
|
@ -5,6 +5,8 @@
|
||||
, genConfigs
|
||||
, sbatch
|
||||
, launcher
|
||||
, control
|
||||
, nixsetup
|
||||
}:
|
||||
|
||||
let
|
||||
@ -22,7 +24,7 @@ let
|
||||
# Job generator helper function
|
||||
genJobs = map (app:
|
||||
sbatch {
|
||||
app = app;
|
||||
app = (nixsetup (control app));
|
||||
nixPrefix = "/gpfs/projects/bsc15/nix";
|
||||
exclusive = false;
|
||||
ntasks = "1";
|
||||
|
@ -38,16 +38,6 @@ stdenv.mkDerivation {
|
||||
cat > $out/bin/run <<EOF
|
||||
#!/bin/sh
|
||||
|
||||
# We need to enter the nix namespace first, in order to have /nix
|
||||
# available, so we use this hack:
|
||||
if [ ! -e /nix ]; then
|
||||
echo "running nix-setup \$0"
|
||||
exec nix-setup \$0
|
||||
fi
|
||||
|
||||
ls -l /nix
|
||||
pwd
|
||||
|
||||
exec $out/bin/nbody -p ${toString particles} -t ${toString timesteps}
|
||||
EOF
|
||||
|
||||
|
29
bsc/garlic/nix-setup.nix
Normal file
29
bsc/garlic/nix-setup.nix
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
stdenv
|
||||
}:
|
||||
|
||||
program:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
inherit program;
|
||||
name = "${program.name}-nixsetup";
|
||||
preferLocalBuild = true;
|
||||
phases = [ "installPhase" ];
|
||||
dontPatchShebangs = true;
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cat > $out/bin/run <<EOF
|
||||
#!/bin/sh
|
||||
|
||||
# We need to enter the nix namespace first, in order to have /nix
|
||||
# available, so we use this hack:
|
||||
if [ ! -e /nix ]; then
|
||||
>&2 echo "running nix-setup \$0"
|
||||
exec nix-setup \$0
|
||||
fi
|
||||
|
||||
exec $program/bin/run
|
||||
EOF
|
||||
chmod +x $out/bin/run
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue
Block a user