diff --git a/pin.nix b/pin.nix new file mode 100644 index 0000000..9e01880 --- /dev/null +++ b/pin.nix @@ -0,0 +1,16 @@ +let + # 2021-08-15 + nix-rev = "3ab8ce12c2db31268f579c11727d9c63cfee2eee"; + nix-src = builtins.fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/${nix-rev}.tar.gz"; + sha256 = "13fx0yb95gxyk0jyvgrxv2yp4fj54g7nzrlvjfc8slx9ccqd2v86"; + }; +in import nix-src { + overrides = [ + (self: super: { + ocaml = self.ocaml_4_03; + ocamlPackages = super.ocamlPackages.overrideAttrs + (attrs: attrs // { ocaml = self.ocaml_4_03; }); + }) + ]; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..29d1f67 --- /dev/null +++ b/shell.nix @@ -0,0 +1,52 @@ +let + pkgs = import ./pin.nix; + ocaml-xkbcommon = pkgs.ocamlPackages.buildDunePackage { + pname = "xkbcommon"; + version = "0.1"; + minimumOcamlVersion = "4.04"; + useDune2 = true; + src = pkgs.fetchFromGitHub { + owner = "Armael"; + repo = "ocaml-xkbcommon"; + rev = "af0cd8c938938db3e67b65ac13b6444102756ba0"; + sha256 = "0zh80aczdn821xkwjn8m74mjcqb6f1hj0qfh1kxrz2z9h5as2r8k"; + }; + buildInputs = [ pkgs.libxkbcommon pkgs.ocamlPackages.dune-configurator ]; + propagatedBuildInputs = [ + pkgs.ocamlPackages.ctypes + pkgs.ocamlPackages.base + pkgs.ocamlPackages.stdio + pkgs.libxkbcommon + ]; + meta = { + homepage = "https://github.com/Armael/ocaml-xkbcommon"; + synopsis = "OCaml bindings to xkbcommon"; + description = "This package provides OCaml bindings to xkbcommon"; + maintainers = [ ]; + }; + }; + ocaml-unix-time = pkgs.callPackage (import ./unix-time.nix) { }; +in pkgs.mkShell { + name = "wlroots-ocaml-shell"; + propagatedNativeBuildInputs = [ + pkgs.ocamlPackages.ctypes + pkgs.ocamlPackages.dune-configurator + pkgs.ocamlPackages.mtime + ocaml-unix-time + ocaml-xkbcommon + ]; + nativeBuildInputs = [ + pkgs.dune_2 + pkgs.ocamlPackages.findlib + # Should be put upstream as an input for wlroots + pkgs.libudev + pkgs.m4 + pkgs.ocaml + pkgs.pixman + pkgs.pkg-config + pkgs.less + pkgs.wayland + pkgs.wayland-protocols + pkgs.wlroots + ]; +} diff --git a/unix-time.nix b/unix-time.nix new file mode 100644 index 0000000..c1263cf --- /dev/null +++ b/unix-time.nix @@ -0,0 +1,27 @@ +{ ocamlPackages, fetchFromGitHub }: +ocamlPackages.buildOcaml rec { + name = "unix-time"; + version = "0.1.0"; + minimumOcamlVersion = "4.04"; + src = fetchFromGitHub { + owner = "dsheets"; + repo = "ocaml-unix-time"; + rev = version; + sha256 = "0000000000000000000000000000000000000000000000000000"; + }; + doCheck = true; + nativeBuildInputs = [ ocamlPackages.alcotest ocamlPackages.ctypes ]; + propagatedBuildInputs = [ ocamlPackages.unix-errno ocamlPackages.base-unix ]; + meta = { + homepage = "https://github.com/dsheets/ocaml-unix-time"; + synopsis = "Unix time.h types, maps, and support"; + description = '' + unix-time provides access to the features exposed in time.h in a way + that is not tied to the implementation on the host system. + The Time module provides types which are analogous to those defined in + time.h such as timespec. + The Time_unix module provides a ctypes view for timespec. + ''; + maintainers = [ ]; + }; +}