diff options
Diffstat (limited to 'flakes/openfoodnetwork/default.nix')
-rw-r--r-- | flakes/openfoodnetwork/default.nix | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/flakes/openfoodnetwork/default.nix b/flakes/openfoodnetwork/default.nix new file mode 100644 index 0000000..dd68177 --- /dev/null +++ b/flakes/openfoodnetwork/default.nix | |||
@@ -0,0 +1,39 @@ | |||
1 | { bundlerEnv, defaultGemConfig, writeShellScript, v8, stdenv }: | ||
2 | |||
3 | let | ||
4 | gems = bundlerEnv { | ||
5 | name = "openfoodnetwork"; | ||
6 | gemfile = ./Gemfile; | ||
7 | lockfile = ./Gemfile.lock; | ||
8 | gemset = import ./gemset.nix; | ||
9 | gemConfig = defaultGemConfig // { | ||
10 | libv8-node = attrs: { | ||
11 | dontBuild = false; | ||
12 | postPatch = let | ||
13 | noopScript = writeShellScript "noop" "exit 0"; | ||
14 | linkFiles = writeShellScript "link-files" '' | ||
15 | cd ../.. | ||
16 | |||
17 | mkdir -p vendor/v8/out.gn/libv8/obj/ | ||
18 | ln -s "${v8}/lib/libv8.a" vendor/v8/out.gn/libv8/obj/libv8_monolith.a | ||
19 | |||
20 | ln -s ${v8}/include vendor/v8/include | ||
21 | |||
22 | mkdir -p ext/libv8-node | ||
23 | echo '--- !ruby/object:Libv8::Node::Location::Vendor {}' >ext/libv8-node/.location.yml | ||
24 | ''; | ||
25 | in '' | ||
26 | cp ${noopScript} libexec/build-libv8 | ||
27 | cp ${noopScript} libexec/build-monolith | ||
28 | cp ${noopScript} libexec/download-node | ||
29 | cp ${noopScript} libexec/extract-node | ||
30 | cp ${linkFiles} libexec/inject-libv8 | ||
31 | ''; | ||
32 | }; | ||
33 | }; | ||
34 | }; | ||
35 | in | ||
36 | stdenv.mkDerivation { | ||
37 | name = "openfoodnetwork"; | ||
38 | inherit | ||
39 | } | ||