ryangibb / hillingar Goto Github PK
View Code? Open in Web Editor NEWBuild Mirage unikernels with Nix
Build Mirage unikernels with Nix
Will require mirage configure
and opam monorepo lock
outside of a nix derivation.
Kind of similar to https://github.com/tweag/opam-nix/#materialization but using opam-native mirage/<unikernel-name>.opam.locked
isntead of opam-nix's package-defs.json
While trying to use Hillingar to build a personal Mirage project, I ran into an issue with mirage-crypto
failing to build due to missing zarith
library. Here's the full stack trace:
error: builder for '/nix/store/0bqbv7r56k8jvqx95vpz18y56gjicaxj-http-fetch-dev.drv' failed with exit code 1;
last 18 log lines:
> unpacking sources
> unpacking source archive /nix/store/j1rcjp30l112minzk1wqyh9r9pia9bai-3x9vch4pay7082gpg0kjp0jx4r873sjs-configured-src
> source root is 3x9vch4pay7082gpg0kjp0jx4r873sjs-configured-src
> preBuild
> building
> File "duniverse/mirage-crypto/pk/dune", line 4, characters 20-26:
> 4 | (libraries cstruct zarith mirage-crypto mirage-crypto-rng sexplib0 eqaf.cstruct)
> ^^^^^^
> Error: Library "zarith" not found.
> -> required by library "mirage-crypto-pk" in
> _build/default/duniverse/mirage-crypto/pk
> -> required by executable main in device-usage/http-fetch/dune.build:13
> -> required by _build/default/device-usage/http-fetch/main.exe
> -> required by _build/default/device-usage/http-fetch/http-fetch
> -> required by _build/default/device-usage/http-fetch/dist/http-fetch
> -> required by alias device-usage/http-fetch/dist/all
> -> required by alias device-usage/http-fetch/dist/default
>
I was able to repo this using the mirage skeleton repo using the device-usage/http-fetch
example, which only depends on cohttp. This occurs with Mirage 4.5.0 (due to the change in arg handling) on both Ocaml 4.14.1 and Ocaml 5.1.1. The same unikernel builds via traditional opam methods, but it's totally possible I'm missing something simple.
Happy to provide any additional information, as I'm sure my initial report isn't very helpful.
Thanks for an awesome project, I'm really excited to use it more!
E.g. use
$ opam monorepo lock
$ opam monorepo list
(or read the lockfile instead of list)
E.g. omit mirage configure -t <target>
step.
Updating the flake inputs of the example repo causes it to fail to build
since the release of ptime.1.1.0
, even when ensuring ocaml 4 is used.
This invocation fails to build (my fork just updates the flake.lock
and adds package "ocaml" ~max:"5.0.0"
to the packages
in the config.ml
):
nix build "github:LogicalOverflow/mirage-hello-hillingar" --override-input opam-repository \
"github:ocaml/opam-repository?rev=49c3ad31df3f2f60c2006211900b6553c097277c"
With the following error:
File "duniverse/mirage-logs/src/dune", line 4, characters 50-55:
4 | (libraries logs mirage-clock lwt mirage-profile ptime))
^^^^^
Error: Library "ptime" not found.
-> required by library "mirage-logs" in
_build/default/duniverse/mirage-logs/src
-> required by executable main in dune.build:12
-> required by _build/default/main.exe
-> required by _build/default/hello
-> required by _build/default/dist/hello
-> required by alias dist/all
-> required by alias dist/default
The previous commit of opam-repository
still works:
nix build "github:LogicalOverflow/mirage-hello-hillingar" --override-input opam-repository \
"github:ocaml/opam-repository?rev=29869b0a1ad4fb7fc4a08d8a888a7abb6d0fa5cc"
The first bad commit is ocaml/opam-repository@49c3ad3, which adds ptime.1.1.0
I am not sure yet, where the issue lies (here, with opam-nix or somewhere else), but I am still able to build the example unikernel without nix. (mirage configure -t unix
followed by make
)
As a work-around, adding package "ptime" ~max:"1.1.0"
to the packages
in the config.ml
allows the build with nix to work again.
E.g. for github.com/RyanGibb/mirage-www (which now builds with Nix using Hillingar)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.