-
Notifications
You must be signed in to change notification settings - Fork 8
/
default.nix
73 lines (69 loc) · 2.1 KB
/
default.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
let inputs = (import (
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/35bb57c0c8d8b62bbfd284272c928ceb64ddbde9.tar.gz";
sha256 = "1prd9b1xx8c0sfwnyzkspplh30m613j42l1k789s521f4kv4c2z2"; }
) {
src = ./.;
}).defaultNix.inputs;
hs-nix-infra = inputs.hs-nix-infra;
pkgsDef = import hs-nix-infra.nixpkgs {
config = hs-nix-infra.haskellNix.config;
overlays = [ hs-nix-infra.haskellNix.overlay] ;
};
in
{ pkgs ? pkgsDef
, dontStrip ? false
, threaded ? true
, enableProfiling ? false
, dockerTag ? "latest"
, baseImageDef ? {
imageName = "ubuntu";
imageDigest = "sha256:965fbcae990b0467ed5657caceaec165018ef44a4d2d46c7cdea80a9dff0d1ea";
sha256 = "10wlr8rhiwxmz1hk95s9vhkrrjkzyvrv6nshg23j86rw08ckrqnz";
finalImageTag = "22.04";
finalImageName = "ubuntu";
}
, ...
}:
let profilingModule = {
enableLibraryProfiling = enableProfiling;
enableProfiling = enableProfiling;
};
project = pkgs.haskell-nix.cabalProject' {
src = ./.;
compiler-nix-name = "ghc963";
shell.tools = {
cabal = {};
};
modules =
pkgs.lib.optional enableProfiling profilingModule ++
[{
packages.pact.components.library.ghcOptions = [ "-Wwarn" ];
}];
};
flake = project.flake';
default = flake.packages."chainweb-data:exe:chainweb-data".override (old: {
inherit dontStrip;
flags = old.flags // {
inherit threaded;
};
});
baseImage = pkgs.dockerTools.pullImage baseImageDef;
dockerImage = pkgs.dockerTools.buildImage {
name = "chainweb-data";
tag = dockerTag;
fromImage = baseImage;
copyToRoot = pkgs.runCommand "copyToRoot" {} ''
mkdir -p $out/usr/local/bin/
ln -s "${default}/bin/chainweb-data" $out/usr/local/bin/
mkdir -p $out/chainweb-data
'';
config = {
WorkingDir = "/chainweb-data";
Volumes = { "/chainweb-data" = {}; };
Entrypoint = [ "chainweb-data" ];
};
};
in {
inherit project flake default dockerImage;
}