nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchurl,
5 makeWrapper,
6 getconf,
7 ocaml,
8 unzip,
9 ncurses,
10 curl,
11 bubblewrap,
12}:
13
14assert lib.versionAtLeast ocaml.version "4.08.0";
15
16stdenv.mkDerivation (finalAttrs: {
17 pname = "opam";
18 version = "2.5.0";
19
20 src = fetchurl {
21 url = "https://github.com/ocaml/opam/releases/download/${finalAttrs.version}/opam-full-${finalAttrs.version}.tar.gz";
22 hash = "sha256-JfuY+WLEInwSYeFCr8aKQWd45ugZYAvV7j7EoYrh4jg=";
23 };
24
25 strictDeps = true;
26
27 nativeBuildInputs = [
28 makeWrapper
29 unzip
30 ocaml
31 curl
32 ];
33 buildInputs = [
34 ncurses
35 getconf
36 ]
37 ++ lib.optionals stdenv.hostPlatform.isLinux [ bubblewrap ];
38
39 patches = [ ./opam-shebangs.patch ];
40
41 configureFlags = [
42 "--with-vendored-deps"
43 "--with-mccs"
44 ];
45
46 outputs = [
47 "out"
48 "installer"
49 ];
50 setOutputFlags = false;
51
52 postInstall = ''
53 wrapProgram $out/bin/opam \
54 --suffix PATH : ${
55 lib.makeBinPath (
56 [
57 curl
58 getconf
59 unzip
60 ]
61 ++ lib.optionals stdenv.hostPlatform.isLinux [ bubblewrap ]
62 )
63 }
64 $out/bin/opam-installer --prefix=$installer opam-installer.install
65 '';
66
67 doCheck = false;
68
69 meta = {
70 description = "Package manager for OCaml";
71 homepage = "https://opam.ocaml.org/";
72 changelog = "https://github.com/ocaml/opam/raw/${finalAttrs.version}/CHANGES";
73 maintainers = [ ];
74 license = lib.licenses.lgpl21Only;
75 platforms = lib.platforms.all;
76 };
77})