forked from kadena-io/chainweaver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
105 lines (98 loc) · 3.57 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
args@{ system ? builtins.currentSystem
, iosSdkVersion ? "10.2"
, terms ? { # Accepted terms, conditions, and licenses
security.acme.acceptTerms = true;
}
, kpkgs ? import ./dep/kpkgs { inherit system; } # If you want a custom package set, pass it into
# kpkgs arg
, obelisk ? (import ./.obelisk/impl { inherit system iosSdkVersion terms; inherit (kpkgs) reflex-platform-func;})
, withHoogle ? false
}:
with obelisk;
let
pkgs = obelisk.reflex-platform.nixpkgs;
# All the versions that the user cares about are here so that they can
# be changed in one place
chainweaverVersion = "2.2.1";
appName = "Kadena Chainweaver";
macReleaseNumber = "0";
linuxReleaseNumber = "0";
ovaReleaseNumber = "0";
obApp = import ./obApp.nix { inherit obelisk; };
pactServerModule = import ./pact-server/service.nix;
sass = pkgs.runCommand "sass" {} ''
set -eux
mkdir $out
${pkgs.sass}/bin/sass ${./backend/sass}/index.scss $out/sass.css
'';
macApp = (import ./mac.nix) {
inherit obApp pkgs appName sass chainweaverVersion macReleaseNumber;
};
homeManagerModule = obelisk.reflex-platform.hackGet ./dep/home-manager + /nixos;
linuxApp = (import ./linux.nix) {
inherit obApp pkgs appName sass homeManagerModule chainweaverVersion linuxReleaseNumber ovaReleaseNumber;
};
in obApp // rec {
inherit sass;
inherit (macApp) mac deployMac;
inherit (linuxApp) nixosExe deb chainweaverVM chainweaverVMSystem;
server = { hostName, adminEmail, routeHost, enableHttps, version, module ? obelisk.serverModules.mkBaseEc2 }@args:
let
exe = serverExe
obApp.ghc.backend
obApp.ghcjs.frontend
obApp.passthru.staticFiles
obApp.passthru.__closureCompilerOptimizationLevel
version;
nixos = import (pkgs.path + /nixos);
in nixos {
system = "x86_64-linux";
configuration = {
imports = [
(module { inherit exe hostName adminEmail routeHost enableHttps version; nixosPkgs = pkgs; })
(obelisk.serverModules.mkDefaultNetworking args)
(obelisk.serverModules.mkObeliskApp (args // { inherit exe; }))
./acme.nix # Backport of ACME upgrades from 20.03
# (pactServerModule {
# hostName = routeHost;
# inherit obApp pkgs;
# # The exposed port of the pact backend (proxied by nginx).
# nginxPort = 7011;
# pactPort = 7010;
# pactDataDir = "/var/lib/chainweaver";
# pactUser = "pact";
# })
];
# Backport of ACME upgrades from 20.03
disabledModules = [
(pkgs.path + /nixos/modules/security/acme.nix)
];
nixpkgs.overlays = [
(self: super: {
lego = (import (builtins.fetchTarball {
url = https://github.com/NixOS/nixpkgs-channels/archive/70717a337f7ae4e486ba71a500367cad697e5f09.tar.gz;
sha256 = "1sbmqn7yc5iilqnvy9nvhsa9bx6spfq1kndvvis9031723iyymd1";
}) {}).lego;
})
];
system.activationScripts = {
setupBackendRuntime = {
text = ''
mkdir -p /var/lib/chainweaver/dyn-configs
'';
deps = [];
};
};
};
};
ci =
let cross = {
inherit (obApp) exe;
inherit (obApp.ghc) desktop;
shell = obApp.shells.ghc { withHoogle = true; };
};
in {
mac = cross // { inherit mac; };
linux = cross // { inherit (linuxApp) nixosExe deb chainweaverVM chainweaverVMSystem; };
};
}