2020-07-09 12:04:40 +02:00
|
|
|
# ginsim.nix
|
|
|
|
#
|
|
|
|
# Packages GINsim.
|
|
|
|
#
|
|
|
|
# You can build this file with the following command:
|
|
|
|
#
|
|
|
|
# nix-build ginsim.nix
|
|
|
|
#
|
2020-07-09 12:30:35 +02:00
|
|
|
# This will create the symlink result in the current directory. The
|
|
|
|
# runnable shell script is result/bin/GINsim.
|
|
|
|
#
|
|
|
|
# You can use this file in a nix-shell, as shell.nix illustrates.
|
2020-07-09 12:04:40 +02:00
|
|
|
|
|
|
|
let
|
2020-07-09 12:30:35 +02:00
|
|
|
# Import nixpkgs to be able to supply reasonable default values for
|
|
|
|
# the anonymous function this file defines.
|
2020-07-09 12:04:40 +02:00
|
|
|
pkgs = import <nixpkgs> {};
|
|
|
|
in
|
2020-07-09 12:30:35 +02:00
|
|
|
# These arguments define the resources (packages and native Nix tools)
|
|
|
|
# that will be used by the package (the anonymous function I define).
|
|
|
|
# I want this file to be buildable directly using the command
|
|
|
|
# nix-build ginsim.nix, so I have to supply reasonable default values
|
|
|
|
# to these arguments. The default values naturally come from the
|
|
|
|
# corresponding attributes of Nixpkgs, visible here under the binding
|
|
|
|
# pkgs.
|
|
|
|
{ stdenv ? pkgs.stdenv
|
|
|
|
, fetchurl ? pkgs.fetchurl
|
|
|
|
, makeWrapper ? pkgs.makeWrapper
|
|
|
|
, jre ? pkgs.jre
|
|
|
|
}:
|
2020-07-09 12:04:40 +02:00
|
|
|
|
2020-07-09 12:30:35 +02:00
|
|
|
# I'll use the default builder, because I don't need any particular
|
|
|
|
# features.
|
2020-07-09 12:04:40 +02:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "GINsim";
|
|
|
|
version = "2.4";
|
|
|
|
|
2020-07-09 12:30:35 +02:00
|
|
|
# Simply fetch the JAR file of GINsim.
|
2020-07-09 12:04:40 +02:00
|
|
|
src = fetchurl {
|
|
|
|
url = "http://ginsim.org/sites/default/files/${name}-${version}.jar";
|
|
|
|
sha256 = "0891q75hli6ghgangscygkqw60x9ikx96i8y4fqca6kdh1xgs15h";
|
|
|
|
};
|
2020-07-09 12:30:35 +02:00
|
|
|
# I fetch the JAR file directly, so no archives to unpack.
|
2020-07-09 12:04:40 +02:00
|
|
|
dontUnpack = true;
|
|
|
|
|
2020-07-09 12:30:35 +02:00
|
|
|
# I need makeWrapper in my build environment to generate the wrapper
|
|
|
|
# shell script. This shell script will call the Java executable on
|
|
|
|
# the JAR file of GINsim and will set the appropriate environment
|
|
|
|
# variables.
|
2020-07-09 12:04:40 +02:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
2020-07-09 12:30:35 +02:00
|
|
|
# The only meaningful phase of this build. I create the
|
|
|
|
# subdirectory share/java/ in the output directory, because this is
|
|
|
|
# where JAR files are typically stored. I also create the
|
|
|
|
# subdirectory bin/ to store the executable shell script. I then
|
|
|
|
# copy the downloaded JAR file to $out/share/java/. Once this is
|
|
|
|
# done, I create the wrapper shell script using makeWrapper. This
|
|
|
|
# script wraps the Java executable (${jre}/bin/java) in the output
|
|
|
|
# shell script file $out/bin/GINsim. The script adds the argument
|
|
|
|
# -jar … to the Java executable, thus pointing it to the actual
|
|
|
|
# GINsim JAR file. On my system (NixOS + XMonad), I need to set
|
|
|
|
# some additional environment variables to get Java windows to
|
|
|
|
# render properly.
|
2020-07-09 12:04:40 +02:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -pv $out/share/java $out/bin
|
|
|
|
cp ${src} $out/share/java/${name}-${version}.jar
|
|
|
|
|
|
|
|
makeWrapper ${jre}/bin/java $out/bin/GINsim \
|
|
|
|
--add-flags "-jar $out/share/java/${name}-${version}.jar" \
|
|
|
|
--set _JAVA_OPTIONS '-Dawt.useSystemAAFontSettings=on' \
|
|
|
|
--set _JAVA_AWT_WM_NONREPARENTING 1
|
|
|
|
'';
|
|
|
|
|
2020-07-09 12:30:35 +02:00
|
|
|
# Some easy metadata, in case I forget. I use the with statement to
|
|
|
|
# avoid typing stdenv.lib to specify the license, the platform and
|
|
|
|
# the maintainer.
|
|
|
|
meta = with stdenv.lib; {
|
2020-07-09 12:04:40 +02:00
|
|
|
homepage = "http://ginsim.org/";
|
|
|
|
description = "A computer tool for the modeling and simulation of genetic regulatory networks.";
|
2020-07-09 12:30:35 +02:00
|
|
|
license = licenses.gpl3;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = [ maintainers.scolobb ];
|
2020-07-09 12:04:40 +02:00
|
|
|
};
|
|
|
|
}
|