Simplify paths

This commit is contained in:
2020-09-21 14:34:08 +02:00
parent dba1cc22bc
commit 126f05e92c
26 changed files with 392 additions and 95 deletions

29
garlic/nbody/argv.nix Normal file
View File

@@ -0,0 +1,29 @@
{
stdenv
, particles
, timestamps
, program
, config
}:
stdenv.mkDerivation {
inherit program;
passthru = {
inherit config;
};
name = "${program.name}-argv";
preferLocalBuild = true;
phases = [ "installPhase" ];
dontPatchShebangs = true;
installPhase = ''
mkdir -p $out/bin
cat > $out/bin/run <<EOF
#!/bin/sh
exec ${program}/bin/run -p ${toString config.particles} -t ${toString config.timesteps}
EOF
chmod +x $out/bin/run
'';
}

68
garlic/nbody/default.nix Normal file
View File

@@ -0,0 +1,68 @@
{
stdenv
, cc
, mpi ? null
, tampi ? null
, mcxx ? null
, cflags ? null
, gitBranch
, gitURL ? "ssh://git@bscpm02.bsc.es/garlic/apps/nbody.git"
, blocksize ? 2048
}:
assert !(tampi != null && mcxx == null);
with stdenv.lib;
stdenv.mkDerivation rec {
name = "nbody";
#src = /home/Computational/rarias/bscpkgs/manual/nbody;
src = builtins.fetchGit {
url = "${gitURL}";
ref = "${gitBranch}";
};
programPath = "/bin/nbody";
buildInputs = [
cc
]
++ optional (mpi != null) mpi
++ optional (tampi != null) tampi
++ optional (mcxx != null) mcxx;
preBuild = (if cflags != null then ''
makeFlagsArray+=(CFLAGS="${cflags}")
'' else "");
postPatch = ""
# This should be fixed in the Makefile as well.
+ ''sed -i 's/libtampi.a/libtampi-c.a/g' Makefile
''
# Dirty HACK until the nbody issue at:
# https://pm.bsc.es/gitlab/garlic/apps/nbody/-/issues/1
# is properly fixed.
+
(if (mpi.pname or "unknown") == "openmpi" then
''sed -i 's/-lstdc++/-lstdc++ -lmpi_cxx/g' Makefile
''
else
""
);
makeFlags = [
"CC=${cc.cc.CC}"
"BS=${toString blocksize}"
]
++ optional (tampi != null) "TAMPI_HOME=${tampi}";
dontPatchShebangs = true;
installPhase = ''
echo ${tampi}
mkdir -p $out/bin
cp nbody* $out/bin/${name}
'';
}