Skip to content

Instantly share code, notes, and snippets.

@dckc
Created February 11, 2019 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dckc/3f7bd9af3ce1534054aaacc4636b2fbe to your computer and use it in GitHub Desktop.
Save dckc/3f7bd9af3ce1534054aaacc4636b2fbe to your computer and use it in GitHub Desktop.
# if you forget the {} on the next line, you get an un-helpful:
# error: value is a function while a set was expected
with import <nixpkgs> {};
let
i2b2-hive-cells = stdenv.mkDerivation rec {
name = "i2b2-hive-cells";
src = fetchurl {
url = "https://github.com/i2b2/i2b2-core-server/archive/v1.7.10.0001.tar.gz";
# used nix-prefetch-url to get the sha256
sha256 = "053b1bwzz23pgs1dg4wz2mzjfp6378dq5j2rm4x7yklp6mdgkd4x";
};
# cribbed from:
# https://nixos.org/nixpkgs/manual/#sec-language-java
buildInputs = [ jdk pkgs.ant ];
cellBuilder = { path, build, ... }: "(cd ${path}; ${build})";
cellInstaller = { path, install, ... }: "(cd ${path}; ${install})";
common = {
installDoc = "https://community.i2b2.org/wiki/display/getstarted/Chapter+4.+i2b2+Server-Common+Install";
path = "edu.harvard.i2b2.server-common";
build = "ant dist -Ddist=$out/dist";
install = "ant deploy jboss_pre_deployment_setup -Ddist=$out/dist -Djboss.home=$out";
};
cells = [ common ];
buildPhase = lib.concatStringsSep "\n" (map cellBuilder cells);
installPhase = lib.concatStringsSep "\n" (map cellInstaller cells);
};
wildfly = stdenv.mkDerivation rec {
name = "wildfly";
# version recommended in i2b2 install docs is 10.0.0.Final 2016-01-29. current is 15.0.1.Final 2019-01-05. hm
version = "10.0.0.Final";
src = fetchurl {
url = "https://www.i2b2.org/software/projects/installer/wildfly-${version}.zip";
sha256 = "1sapwnjha5m2q0y7f7j2mk16m2gcgp23qprcxyybkbpryzfpfd9z";
};
# based on https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/http/jboss/default.nix
buildInputs = [ pkgs.unzip ];
phases = [ "unpackPhase" "installPhase" "fixupPhase" ];
installPhase = ''
mv $PWD $out
find $out/bin -name \*.sh -print0 | xargs -0 sed -i -e '/#!\/bin\/sh/aJAVA_HOME=${jdk}'
'';
};
# wildfly-service = callPackage ./wildfly-service { config = {}; lib = {}; pkgs = pkgs; };
mkWildflyControl = cfg:
stdenv.mkDerivation {
name = "wildfly-service";
builder = ./wildfly-service/builder.sh;
inherit wildfly;
inherit (pkgs) su;
inherit (cfg) tempDir logDir libUrl deployDir serverDir; # @@ user useJK
};
wildfly1c = mkWildflyControl {
tempDir = "/tmp";
logDir = "/var/log/private/wildfly";
# Location where the shared library JARs are stored";
libUrl = "file:///nix/var/nix/profiles/default/server/default/lib"; #@@???
deployDir = "/var/lib/private/wildfly/standalone/deployments";
serverDir = "/var/lib/private/wildfly/standalone";
# user = "wildfly";
# useJK = false
};
wildfly1u = stdenv.mkDerivation {
name="wildfly1-unit";
inherit wildfly;
wildflyControl = wildfly1c;
builder = ./wildfly-service/unit-builder.sh;
};
i2b2-heron = stdenv.mkDerivation {
name = "i2b2-heron";
buildInputs = [ i2b2-hive-cells wildfly1u ];
src = i2b2-hive-cells; # kludge
installPhase = ''
mkdir $out;
ln -s ${i2b2-hive-cells} $out/i2b2-hive-cells
ln -s ${wildfly1u} $out/wildfly
'';
};
in i2b2-heron
$ nix-build --show-trace --keep-failed i2b2.nix
error: while evaluating the attribute 'buildInputs' of the derivation 'i2b2-heron' at /nix/store/98f2ynld46gvwi26xh69f17hlgqa9kwy-nixpkgs-19.03pre166613.c052da08dcb/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:185:11:
while evaluating the attribute 'cellBuilder' of the derivation 'i2b2-hive-cells' at /nix/store/98f2ynld46gvwi26xh69f17hlgqa9kwy-nixpkgs-19.03pre166613.c052da08dcb/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:185:11:
cannot coerce a function to a string, at /nix/store/98f2ynld46gvwi26xh69f17hlgqa9kwy-nixpkgs-19.03pre166613.c052da08dcb/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:185:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment