Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Turn opam-based OCaml projects into Nix derivations

License

NotificationsYou must be signed in to change notification settings

tweag/opam-nix

Repository files navigation

Turn opam-based OCaml projects intoNix derivations,automatically resolving both OCaml and system dependencies.

opam-nix can build packages

It also comes with the power of Nix, allowing you to effortlessly managemultiple projects with different dependency versions, override dependencies,cache builds, and more.

Quick start

For a quick introduction toopam-nix and a guide to get you started, readthis blog post on the Tweag blog.

Templates

opam-nix comes with some templates that can help you package opam packages with Nix.

Note

All of these templates assume that you already have an OCamlproject packaged with opam, and just want to package it with Nix. If you'restarting from scratch, you have to set up the opam files separately.

  • A simple package build, no frills:nix flake init -t github:tweag/opam-nix
  • A more featured flake, building an executable and providing a shell in which you can conveniently work on it:nix flake init -t github:tweag/opam-nix#executable
  • Build multiple packages from the same workspace, and have a shell in which you can work on them:nix flake init -t github:tweag/opam-nix#multi-package

Note

If you're using Git, you shouldgit add flake.nix after initializing, as Nix operates on the git index contents.

Examples

There are also some examples which can give you some ideas of what is possible withopam-nix:

All examples are checks and packages, so you can do e.g.nix build github:tweag/opam-nix#opam-ed to try them out individually, ornix flake check github:tweag/opam-nix to build them all.

Building packages from opam-repository with Nix

opam-nix provides all packages fromopam-repository in itslegacyPackages flake output.You can use this to quickly check out some package, or get a shell with particular version without messing with opam switches.

For example:

  • nix build 'github:tweag/opam-nix#utop."2.10.0"' to build a specific version of utop (available in./result),
  • nix shell github:tweag/opam-nix#camyll.latest to get a shell with the latest version ofcamyll.

Complete documentation

Complete documentation foropam-nix is available in theDOCUMENTATION.md file.

Questions? Problems?

You can reach out to us via theDiscussions page or directly to the maintainervia email.

Related projects

  • Nix: A powerful package manager that makes package management reliable and reproducible;
  • opam: the OCaml package manager;
  • hillingar: Tool for building MirageOS unikernels with opam-nix.

About

Turn opam-based OCaml projects into Nix derivations

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp