Skip to content

Commit 3ec1edf

Browse files
committed
[WIP] Add nix shell.
1 parent a5a92a0 commit 3ec1edf

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed

pin.nix

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
let
2+
# 2021-08-15
3+
nix-rev = "3ab8ce12c2db31268f579c11727d9c63cfee2eee";
4+
nix-src = builtins.fetchTarball {
5+
url = "https://github.com/NixOS/nixpkgs/archive/${nix-rev}.tar.gz";
6+
sha256 = "13fx0yb95gxyk0jyvgrxv2yp4fj54g7nzrlvjfc8slx9ccqd2v86";
7+
};
8+
in import nix-src {
9+
overrides = [
10+
(self: super: {
11+
ocaml = self.ocaml_4_03;
12+
ocamlPackages = super.ocamlPackages.overrideAttrs
13+
(attrs: attrs // { ocaml = self.ocaml_4_03; });
14+
})
15+
];
16+
}

shell.nix

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
let
2+
pkgs = import ./pin.nix;
3+
ocaml-xkbcommon = pkgs.ocamlPackages.buildDunePackage {
4+
pname = "xkbcommon";
5+
version = "0.1";
6+
minimumOcamlVersion = "4.04";
7+
useDune2 = true;
8+
src = pkgs.fetchFromGitHub {
9+
owner = "Armael";
10+
repo = "ocaml-xkbcommon";
11+
rev = "af0cd8c938938db3e67b65ac13b6444102756ba0";
12+
sha256 = "0zh80aczdn821xkwjn8m74mjcqb6f1hj0qfh1kxrz2z9h5as2r8k";
13+
};
14+
buildInputs = [ pkgs.libxkbcommon pkgs.ocamlPackages.dune-configurator ];
15+
propagatedBuildInputs = [
16+
pkgs.ocamlPackages.ctypes
17+
pkgs.ocamlPackages.base
18+
pkgs.ocamlPackages.stdio
19+
pkgs.libxkbcommon
20+
];
21+
meta = {
22+
homepage = "https://github.com/Armael/ocaml-xkbcommon";
23+
synopsis = "OCaml bindings to xkbcommon";
24+
description = "This package provides OCaml bindings to xkbcommon";
25+
maintainers = [ ];
26+
};
27+
};
28+
ocaml-unix-time = pkgs.callPackage (import ./unix-time.nix) { };
29+
in pkgs.mkShell {
30+
name = "wlroots-ocaml-shell";
31+
propagatedNativeBuildInputs = [
32+
pkgs.ocamlPackages.ctypes
33+
pkgs.ocamlPackages.dune-configurator
34+
pkgs.ocamlPackages.mtime
35+
ocaml-unix-time
36+
ocaml-xkbcommon
37+
];
38+
nativeBuildInputs = [
39+
pkgs.dune_2
40+
pkgs.ocamlPackages.findlib
41+
# Should be put upstream as an input for wlroots
42+
pkgs.libudev
43+
pkgs.m4
44+
pkgs.ocaml
45+
pkgs.pixman
46+
pkgs.pkg-config
47+
pkgs.less
48+
pkgs.wayland
49+
pkgs.wayland-protocols
50+
pkgs.wlroots
51+
];
52+
}

unix-time.nix

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{ ocamlPackages, fetchFromGitHub }:
2+
ocamlPackages.buildOcaml rec {
3+
name = "unix-time";
4+
version = "0.1.0";
5+
minimumOcamlVersion = "4.04";
6+
src = fetchFromGitHub {
7+
owner = "dsheets";
8+
repo = "ocaml-unix-time";
9+
rev = version;
10+
sha256 = "0000000000000000000000000000000000000000000000000000";
11+
};
12+
doCheck = true;
13+
nativeBuildInputs = [ ocamlPackages.alcotest ocamlPackages.ctypes ];
14+
propagatedBuildInputs = [ ocamlPackages.unix-errno ocamlPackages.base-unix ];
15+
meta = {
16+
homepage = "https://github.com/dsheets/ocaml-unix-time";
17+
synopsis = "Unix time.h types, maps, and support";
18+
description = ''
19+
unix-time provides access to the features exposed in time.h in a way
20+
that is not tied to the implementation on the host system.
21+
The Time module provides types which are analogous to those defined in
22+
time.h such as timespec.
23+
The Time_unix module provides a ctypes view for timespec.
24+
'';
25+
maintainers = [ ];
26+
};
27+
}

0 commit comments

Comments
 (0)