-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
53 lines (50 loc) · 1.62 KB
/
flake.nix
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
{
description = "Flake for elune";
nixConfig = {
# TODO: Add cache!
bash-prompt = "\\[\\e[0;37m\\](\\[\\e[0m\\]nix) \\[\\e[0;1;32m\\]elune\\[\\e[0m\\]\\w \\[\\e[0;1m\\]λ \\[\\e[0m\\]";
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
rescript-compiler = {
url = "github:rescript-lang/rescript-compiler?ref=10.1.3";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils, rescript-compiler }:
# TODO: Add linter hooks?
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = import nixpkgs { inherit system; };
lib = pkgs.lib;
stdenv = pkgs.stdenv;
nodejs = pkgs.nodejs-18_x;
python3 = pkgs.python39;
ocaml-ng = pkgs.ocaml-ng;
rescript = pkgs.callPackage ./rescript.nix {
inherit stdenv nodejs python3 ocaml-ng rescript-compiler;
};
in
{
devShell = pkgs.mkShell {
buildInputs = [
nodejs
rescript
];
shellHook = ''
npm install
# Warning: Do it after npm install!
ln -s "${rescript}/rescript" "$PWD/node_modules/.bin/rescript"
ln -s ${rescript} "$PWD/node_modules/rescript"
export PATH="${rescript}:$PWD/node_modules/.bin:$PATH"
rescript build -with-deps
'';
NIX_LD_LIBRARY_PATH = lib.makeLibraryPath [
stdenv.cc.cc
];
NIX_LD = lib.fileContents "${stdenv.cc}/nix-support/dynamic-linker";
};
}
);
}