Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
flake init (herc)
Browse files Browse the repository at this point in the history
  • Loading branch information
quinn-dougherty authored and cristianoc committed Aug 30, 2022
1 parent cd10ad3 commit 0c16c75
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ dist/gentype-*.tgz
dist/LICENSE
dist/package.json
examples/typescript-react-example/.eslintcache
result
26 changes: 26 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
description = "genType herc CI";

inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
};

outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
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_2 ];
buildPhase = "dune build";
installPhase = ''
mkdir -p $out
cp -r _build/default/src/GenType.exe $out
'';
};
in {

packages."${system}" = {
gentype = gentype;
};
defaultPackage."${system}" = self.packages."${system}".gentype;
};
}
18 changes: 18 additions & 0 deletions nixos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# This script is only relevant if you're rolling nixos.

# Esy (a bisect_ppx dependency/build tool) is borked on nixos without using an FHS shell. https://github.com/esy/esy/issues/858
# We need to patchelf rescript executables. https://github.com/NixOS/nixpkgs/issues/107375
set -x

fhsShellName="gentype-development"
fhsShellDotNix="{pkgs ? import <nixpkgs> {} }: (pkgs.buildFHSUserEnv { name = \"${fhsShellName}\"; targetPkgs = pkgs: [pkgs.yarn]; runScript = \"yarn\"; }).env"
nix-shell - <<<"$fhsShellDotNix"

# theLd=$(patchelf --print-interpreter $(which mkdir))
# patchelf --set-interpreter $theLd ./node_modules/gentype/gentype.exe
# patchelf --set-interpreter $theLd ./node_modules/rescript/linux/*.exe
# patchelf --set-interpreter $theLd ./node_modules/bisect_ppx/ppx
# # patchelf --set-interpreter $theLd ./node_modules/bisect_ppx/bisect-ppx-report
# theSo=$(find /nix/store/*$fhsShellName*/lib64 -name libstdc++.so.6 | head -n 1)
# patchelf --replace-needed libstdc++.so.6 $theSo ./node_modules/rescript/linux/ninja.exe
25 changes: 25 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


debug@^4.1.0:
version "4.3.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
dependencies:
ms "2.1.2"

ms@2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==

reanalyze@^1.6.0:
version "1.16.0"
resolved "https://registry.yarnpkg.com/reanalyze/-/reanalyze-1.16.0.tgz#e0935acb797d75e62d7b4f5dceffc6fdd52e1950"
integrity sha512-U8fbzKxKrQCcE9pFcrBQ4E1/n+3TlTaga8CQS7Qcys6zyhDLYXCbdGp5V7g+UcM2AI+xEusnPogUIwpnyNiVPQ==

rescript@^9.1.1:
version "9.1.4"
resolved "https://registry.yarnpkg.com/rescript/-/rescript-9.1.4.tgz#1eb126f98d6c16942c0bf0df67c050198e580515"
integrity sha512-aXANK4IqecJzdnDpJUsU6pxMViCR5ogAxzuqS0mOr8TloMnzAjJFu63fjD6LCkWrKAhlMkFFzQvVQYaAaVkFXw==

0 comments on commit 0c16c75

Please sign in to comment.