summaryrefslogtreecommitdiff
path: root/devenv.nix
blob: dc5f298a1bc53810cc7d961dff7053b538ce88e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
{
  pkgs,
  lib,
  config,
  inputs,
  ...
}: let
  oopkgs = import inputs.nix-ocaml {system = pkgs.system;};
  opkgs = oopkgs.ocamlPackages;

  ocaml-quickjs = opkgs.buildDunePackage {
    name = "quickjs";
    pname = "quickjs";
    version = "0.1.1";
    # src = pkgs.fetchFromGitHub {
    #   owner = "dhcmrlchtdj";
    #   repo = "ocaml-quickjs";
    #   rev = "master";
    #   sha256 = "sha256-CIMxkElHW6GARt8WKe+mr+G/MNkMfxvP/Q6yI1nFG+M=";
    # };
    # src = inputs.quickjs-ml;
    # src = pkgs.fetchFromGitHub {
    #   fetchSubmodules = true;
    #   owner = "ml-in-barcelona";
    #   repo = "quickjs.ml";
    #   rev = "master";
    #   sha256 = "zS1kBkpg6mipGr8IGS5tRP//Hws5EhDhT1Izc2DuwT0=";
    # };
    src = ./quickjs.ml;
    # src = builtins.fetchurl {
    #   url = "https://github.com/ml-in-barcelona/quickjs.ml?submodules=1";
    #   sha256 = "0szmgj980l3jah5lsz63fpniz34sr5rabhriv0srv58wp8qh858h";
    # };
    doCheck = true;
    buildInputs = [pkgs.git];
    propagatedBuildInputs = [
      pkgs.git
      opkgs.alcotest
      opkgs.integers
      opkgs.ctypes
    ];
  };
  melange-json-native = opkgs.buildDunePackage {
    pname = "melange-json-native";
    version = "1.3.0";
    src = builtins.fetchurl {
      url = "https://github.com/melange-community/melange-json/releases/download/2.0.0/melange-json-2.0.0.tbz";
      sha256 = "1n1avcplidrigkch4y8lnh136g5q06d0xhgzvgips3y399lw2jah";
    };
    propagatedBuildInputs = with opkgs; [ppxlib yojson];
  };

  server-reason-react = opkgs.buildDunePackage {
    pname = "server-reason-react";
    version = "n/a";
    doCheck = true;

    src = ./srr;
    # src = pkgs.fetchFromGitHub {
    #   owner = "ml-in-barcelona";
    #   repo = "server-reason-react";
    #   rev = "d5dd436b0a447ff0a82f9a8d7a02f102139299a9";
    #   sha256 = "sha256-CIMxkElHW6GARt8WKe+mr+G/MNkMfxvP/Q6yI1nFG+M=";
    # };
    nativeBuildInputs = with opkgs; [
      ocamlformat
      reason
      melange
      reason-native.refmterr
    ];
    propagatedBuildInputs =
      (with opkgs; [
        reason-react
        reason-react-ppx
        melange-json
        melange-json-native
        alcotest-lwt
        ocamlformat
        uucp
        ocaml-quickjs
        yojson
        uri
        melange
        ocaml_pcre
        lwt
        lwt_ppx
      ])
      ++ [pkgs.nodejs];
  };
  # nix-ocaml = inputs.nix-ocaml.legacyPackages.${pkgs.system};
in {
  # https://devenv.sh/packages/
  env.WTF = pkgs.lib.makeLibraryPath config.packages;
  packages =
    (with pkgs; [
      git
      watchexec
      sqlite
      pkg-config
      coreutils-full
    ])
    ++ (with oopkgs; [ocaml opam dune_3])
    ++ [
      # server-reason-react
      melange-json-native
    ]
    ++ (with opkgs; [
      base
      core
      utop
      ocamlformat
      ocaml_sqlite3
      eio
      integers
      uri
      yojson
      melange
      dream
      melange-webapi
      melange-fetch
      melange-json
      reason
      reason-react
      ocaml-lsp
      ppx_yojson_conv
    ]);

  # https://devenv.sh/languages/
  languages.javascript = {
    enable = true;
    npm.enable = true;
  };

  # https://devenv.sh/processes/
  # processes.cargo-watch.exec = "cargo-watch";

  # https://devenv.sh/services/
  # services.postgres.enable = true;

  # https://devenv.sh/scripts/
  scripts.hello.exec = ''
    echo hello from $GREET
  '';

  enterShell = ''
    hello
    git --version
  '';

  # https://devenv.sh/tasks/
  # tasks = {
  #   "myproj:setup".exec = "mytool build";
  #   "devenv:enterShell".after = [ "myproj:setup" ];
  # };

  # https://devenv.sh/tests/
  enterTest = ''
    echo "Running tests"
    git --version | grep --color=auto "${pkgs.git.version}"
  '';

  # https://devenv.sh/git-hooks/
  # git-hooks.hooks.shellcheck.enable = true;

  # See full reference at https://devenv.sh/reference/options/
}