-
Notifications
You must be signed in to change notification settings - Fork 2
/
canton.nix
29 lines (29 loc) · 1005 Bytes
/
canton.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{ pkgs
, jdkVersion ? "jdk"
, version
, cantonSource ? {
url = "https://github.com/digital-asset/daml/releases/download/v${version.number}/canton-open-source-${version.number}.tar.gz";
inherit (version) sha256;
}
, cantonEnterpriseTarball ? pkgs.requireFile {
name = "canton-enterprise-${version.number}.tar.gz";
url = "https://digitalasset.jfrog.io/artifactory/canton-enterprise/canton-enterprise-${version.number}.tar.gz";
inherit (version) sha256;
}
}:
let
jdk = pkgs.${jdkVersion};
useEnterprise = version.type == "enterprise";
in
pkgs.stdenvNoCC.mkDerivation {
name = "canton-${version.type}-${version.number}";
src = if useEnterprise then cantonEnterpriseTarball else builtins.fetchurl cantonSource;
nativeBuildInputs = [pkgs.makeWrapper];
buildInputs = [jdk];
installPhase = "mkdir -p $out; cp -r * $out";
preFixup = ''
# Set CANTON_HOME automatically.
mkdir -p $out/nix-support
echo export CANTON_HOME=$out > $out/nix-support/setup-hook
'';
}