PhysiCell
PhysiCell copied to clipboard
Nixification
I am planning to attend "Computational modelling to study cancer biology and treatments" and rather use the manual process to install PhysiCell on macos in advance, I created a nix derivation for it. NB you don't have to install openmp or set environment variables. It's all done for you and openmp and the C++ compiler are pinned to specific versions. I could probably make it so the script is parameterised but I've done enough for the workshop.
You can run it by downloading the matching settings file and then
nix-build release.nix
./result/bin/biorobots biorobots_PhysiCell_settings.xml
Of course you have to install nix first but that's just
curl https://nixos.org/nix/install | sh
Here are the files you will need
default.nix
{ stdenv
, fetchurl
, llvmPackages
, overrideCC
, gcc }:
let
openmp = llvmPackages.openmp;
in (overrideCC stdenv gcc).mkDerivation rec {
pname = "PhysiCell";
version = "1.7.1";
buildInputs = [ openmp ];
nativeBuildInputs = [ openmp ];
src = fetchurl {
url = "https://github.com/MathCancer/${pname}/archive/${version}.tar.gz";
sha256 = "000pkw8maldb25b8g9cgr5qi4l905073pqrr3nfazc9n990260fi";
};
PHYSICELL_CPP="${gcc}/bin/g++";
project = "biorobots";
buildPhase = ''
make $project-sample
make
'';
installPhase = ''
mkdir -p "$out"/bin
cp $project $out/bin/$project
'';
meta = with stdenv.lib; {
description = "PhysiCell: an Open Source Physics-Based Cell Simulator for 3-D Multicellular Systems.";
homepage = http://physicell.org;
platforms = platforms.all;
maintainers = with maintainers; [ idontgetoutmuch ];
license = licenses.bsd3;
};
}
release.nix
let
nixpkgs = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/20.03.tar.gz";
sha256 = "0182ys095dfx02vl2a20j1hz92dx3mfgz2a6fhn31bqlp1wa8hlq";
};
in
with import nixpkgs {};
callPackage ./default.nix {}