This repository has been archived by the owner on Nov 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathflake.nix
49 lines (45 loc) · 1.71 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
{
description = "genType herc CI";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
system = system;
overlays = [ ];
};
gentype-source = pkgs.mkYarnPackage {
name = "gentype_source";
src = ./.;
packageJSON = ./package.json;
yarnLock = ./yarn.lock;
pkgConfig = {
rescript = {
buildInputs = with pkgs; [ which gcc_multi ];
postInstall = ''
echo "PATCHELF'ING RESCRIPT EXECUTABLES (INCL NINJA)"
# Patching interpreter for linux/*.exe's
THE_LD=$(patchelf --print-interpreter $(which mkdir))
patchelf --set-interpreter $THE_LD linux/*.exe && echo "- patched interpreter for linux/*.exe's"
# Replacing needed shared library for linux/ninja.exe
THE_SO=$(find /nix/store/*/lib64 -name libstdc++.so.6 | head -n 1)
patchelf --replace-needed libstdc++.so.6 $THE_SO linux/ninja.exe && echo "- replaced needed for linux/ninja.exe"
'';
};
};
};
gentype = pkgs.stdenv.mkDerivation {
name = "gentype";
src = gentype-source + "/libexec/gentype/deps/gentype";
buildInputs = with pkgs; [ ocaml dune_1 ];
buildPhase = "dune build";
installPhase = ''
mkdir -p $out
cp -r _build/default/src $out
'';
};
in { packages = flake-utils.lib.flattenTree { default = gentype; }; });
}