opam-mirror/mirage/config.ml

66 lines
2.3 KiB
OCaml
Raw Normal View History

2022-08-25 12:57:03 +00:00
open Mirage
2024-07-15 10:22:57 +00:00
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)|}
2022-08-25 20:47:46 +00:00
let tls_authenticator =
2024-07-15 10:22:57 +00:00
Runtime_arg.create ~pos:__POS__
{|let open Cmdliner in
let doc = "TLS host authenticator. See git_http in lib/mirage/mirage.mli for a description of the format." in
let doc = Arg.info ~doc ["tls-authenticator"] in
Arg.(value & opt (some string) None doc)|}
2022-08-25 12:57:03 +00:00
let mirror =
2024-07-15 10:22:57 +00:00
main "Unikernel.Make"
~runtime_args:[ setup ]
2022-08-25 20:47:46 +00:00
~packages:[
package ~min:"0.3.0" ~sublibs:[ "mirage" ] "paf" ;
package "h2" ;
package "ohex" ;
package "httpaf" ;
2024-07-15 10:22:57 +00:00
package ~max:"0.0.5" "git-kv" ;
package ~min:"3.10.0" "git-paf" ;
2022-08-25 20:47:46 +00:00
package "opam-file-format" ;
package ~min:"3.0.0" ~sublibs:[ "gz" ] "tar" ;
package ~min:"3.0.0" "tar-mirage" ;
package ~max:"0.2.0" "mirage-block-partition" ;
package "gpt" ;
package "gptar" ~pin:"git+https://github.com/reynir/gptar.git" ;
package "oneffs" ;
package "digestif" ;
2022-08-25 20:47:46 +00:00
]
(block @-> time @-> pclock @-> stackv4v6 @-> git_client @-> alpn_client @-> job)
2022-08-25 12:57:03 +00:00
2022-08-25 20:47:46 +00:00
let stack = generic_stackv4v6 default_network
2024-07-15 10:22:57 +00:00
let he = generic_happy_eyeballs stack
let dns = generic_dns_client stack he
2022-08-25 20:47:46 +00:00
let tcp = tcpv4v6_of_stackv4v6 stack
2024-07-15 10:22:57 +00:00
let block = block_of_file "tar"
2022-08-25 20:47:46 +00:00
let git_client, alpn_client =
2024-07-15 10:22:57 +00:00
let git = mimic_happy_eyeballs stack he dns in
merge_git_clients (git_ssh ~key:ssh_key ~authenticator:ssh_authenticator ~password:ssh_password tcp git)
(merge_git_clients (git_tcp tcp git)
(git_http ~authenticator:tls_authenticator tcp git)),
paf_client tcp (mimic_happy_eyeballs stack he dns)
2022-09-07 07:08:45 +00:00
2022-08-25 12:57:03 +00:00
let () = register "mirror"
2024-07-15 10:22:57 +00:00
[ mirror $ block $ default_time $ default_posix_clock $ stack $ git_client $ alpn_client ]