-
Notifications
You must be signed in to change notification settings - Fork 6
/
config.ml
109 lines (95 loc) · 2.83 KB
/
config.ml
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
106
107
108
109
(* (c) Romain Calascibetta 2019 *)
open Mirage
let setup = runtime_arg ~pos:__POS__ "Unikernel.K.setup"
let ssh_key =
Runtime_arg.create ~pos:__POS__
{|let open Cmdliner in
let doc = Arg.info ~doc:"The private SSH key (rsa:<seed> or ed25519:<b64-key>)." ["ssh-key"] in
Arg.(value & opt (some string) None doc)|}
let ssh_authenticator =
Runtime_arg.create ~pos:__POS__
{|let open Cmdliner in
let doc = Arg.info ~doc:"SSH authenticator." ["ssh-auth"] in
Arg.(value & opt (some string) None doc)|}
let ssh_password =
Runtime_arg.create ~pos:__POS__
{|let open Cmdliner in
let doc = Arg.info ~doc:"The private SSH password." [ "ssh-password" ] in
Arg.(value & opt (some string) None doc)|}
let pasteur_js =
let dune _info =
[
Dune.stanzaf
{dune|(subdir public
(rule
(enabled_if (= %%{context_name} "default"))
(deps ../js/pasteur_js.bc.js)
(target pasteur.js)
(action (copy %%{deps} %%{target}))))|dune}
]
in
impl ~dune "Pasteur_js" job
let pasteur_hljs =
let dune _info =
[
Dune.stanzaf
{dune|(rule
(enabled_if (= %%{context_name} "default"))
(mode promote)
(deps js/pasteur_hljs.bc.js public/highlight.js)
(target language.default.ml)
(action (with-stdout-to
%%{target} (bash "node js/pasteur_hljs.bc.js"))))|dune}
; Dune.stanzaf
{dune|(rule
(target language.ml)
(deps %%{exe:language.default.ml})
(action (copy %%{exe:language.default.ml} %%{target})))|dune}
]
in
let files _ = [ Fpath.v "language.ml" ] in
impl ~files ~dune "Pasteur_hljs" job
let packages =
[
package "paf" ~min:"0.5.0"
; package "paf" ~sublibs:[ "mirage" ] ~min:"0.5.0"
; package "letsencrypt-mirage"
; package "uuidm"
; package "tyxml"
; package "git-kv" ~min:"0.0.3"
; package "multipart_form-lwt"
; package "json-data-encoding"
; package "data-encoding"
; package "ezjsonm"
; package "brr" ~build:true ~scope:`Switch
]
let pasteur =
main "Unikernel.Make"
~packages
~runtime_args:[ setup ]
~deps:[ dep pasteur_js; dep pasteur_hljs ]
(random @-> time @-> mclock @-> pclock @-> kv_ro @-> stackv4v6
@-> alpn_client @-> git_client @-> job)
let stack = generic_stackv4v6 default_network
let tcp = tcpv4v6_of_stackv4v6 stack
let he = generic_happy_eyeballs stack
let dns = generic_dns_client stack he
let git =
let git = mimic_happy_eyeballs stack he dns in
git_ssh ~key:ssh_key ~password:ssh_password ~authenticator:ssh_authenticator tcp git
let http_client =
let dns = mimic_happy_eyeballs stack he dns in
paf_client tcp dns
let public = docteur ~extra_deps:[ "public/pasteur.js" ] "relativize://public/"
let () =
register "pasteur"
[ pasteur
$ default_random
$ default_time
$ default_monotonic_clock
$ default_posix_clock
$ public
$ stack
$ http_client
$ git
]