-
Notifications
You must be signed in to change notification settings - Fork 3
/
default.nix
77 lines (68 loc) · 1.98 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
74
75
76
77
{}:
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs { };
haskellCompiler = "ghc927";
haskellPackages = pkgs.haskell.packages.${haskellCompiler};
static = import (sources.static-haskell-nix + "/survey") {
compiler = haskellCompiler;
integer-simple = false;
};
staticHaskellPackages = static.haskellPackagesWithLibsReadyForStaticLinking;
d3 = builtins.fetchurl {
url = "https://d3js.org/d3.v5.min.js";
sha256 = "0g5529s28dm27sqp5zzff1ipva1fyipdswl51c7h3ps7715r5gjx";
};
bootstrap = builtins.fetchurl {
url = "https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css";
sha256 = "0dldiln2s3z8iqc5ccjid2i5gh9527naas064bwly8x9lrfrxcb0";
};
in
rec {
backend = haskellPackages.callPackage ./nix/grafanix-backend.nix {
static = false;
};
backend-static = staticHaskellPackages.callPackage ./nix/grafanix-backend.nix {
static = true;
ncurses = static.pkgs.ncurses.override {
enableStatic = true;
};
zlib = static.pkgs.zlib;
};
frontend = pkgs.callPackage ./frontend/default.nix { };
grafanix = pkgs.callPackage ./nix/grafanix.nix {
inherit bootstrap d3;
inherit backend frontend;
};
grafanix-static = pkgs.callPackage ./nix/grafanix.nix {
inherit bootstrap d3;
inherit frontend;
backend = backend-static;
};
grafanix-release = pkgs.callPackage ./nix/grafanix-release.nix {
grafanix = grafanix-static;
};
shell = (
pkgs.haskell.lib.addBuildTools
backend
(
[
haskellPackages.cabal2nix
haskellPackages.cabal-install
haskellPackages.ghcide
haskellPackages.ormolu
pkgs.elm2nix
pkgs.inotify-tools
pkgs.niv
pkgs.treefmt
] ++ frontend.buildInputs
)
).env.overrideAttrs (
old: {
shellHook = ''
ln -snfv ${bootstrap} ${builtins.toString ./.}/static/bootstrap.css
ln -snfv ${d3} ${builtins.toString ./.}/static/d3.js
'';
}
);
}