-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell2.nix
60 lines (55 loc) · 3.15 KB
/
shell2.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
54
55
56
57
58
59
with import <nixpkgs> {};
runCommand "openfaas-examples" {
buildInputs = [
haskell.packages.ghc910.cabal-install
# haskell.compiler.ghcjs
nodejs_18
gcc
doctl
] ++ (if builtins.currentSystem == "aarch64-linux" then [
# This is somehow wrong as it gives a `ghc` and not a cross platform ghc compiler.
#(pkgsCross.gnu64.pkgsBuildHost.haskell.packages.ghc910.ghcWithPackages (ghc: with ghc; [
# aeson
#]))
# So is this, so it's probably a bug.
#(pkgsCross.gnu64.pkgsBuildTarget.haskell.packages.ghc910.ghcWithPackages (ghc: with ghc; [
# aeson
#]))
# We're stuck with this which is somehow okay but doesn't touch the packages above
# 9.6 dies at building p11kit because it's trying to run a test when it shouldn't be
pkgsCross.gnu64.pkgsBuildHost.haskell.compiler.ghc910
# Probably because this is what we actually want to be able to look at... but it's not cached right now so I can't work on it.
pkgsCross.gnu64.pkgsHostHost.haskell.packages.ghc910.aeson
pkgsCross.gnu64.pkgsBuildHost.gcc
# pkgsCross.gnu64.pkgsHostHost.glibc
pkgsCross.gnu64.pkgsHostHost.gmp
pkgsCross.gnu64.pkgsHostHost.libffi
] else [
(haskell.packages.ghc910.ghcWithPackages (ghc: with ghc; [
aeson
cabal-install
]))
]);
# cp ${pkgsCross.gnu64.pkgsHostHost.libffi.outPath}/lib64/libffi.so.8.1.2 packages/sample/hello/libffi.so.8
# cp ${pkgsCross.gnu64.pkgsHostHost.gmp.outPath}/lib64/libgmp.so.10.4.1 packages/sample/hello/libgmp.so.10
# cp ${pkgsCross.gnu64.pkgsHostHost.glibc.outPath}/libc.so.6 packages/sample/hello/libc.so.6
# cp ${pkgsCross.gnu64.pkgsHostHost.glibc.outPath}/libm.so.6 packages/sample/hello/libm.so.6
# cp ${pkgsCross.gnu64.pkgsHostHost.glibc.outPath}/librt.so.1 packages/sample/hello/librt.so.1
# cp ${pkgsCross.gnu64.pkgsHostHost.glibc.outPath}/libdl.so.2 packages/sample/hello/libdl.so.2
#
shellHook = ''
# x86_64-unknown-linux-gnu-ghc src/Main.hs -ilib -o packages/sample/hello/openfaas-examples
# rm src/Main src/Main.{hi,o}
#cabal new-build
#cp $(cabal exec which openfaas-examples) packages/sample/hello/openfaas-examples
#x86_64-unknown-linux-gnu-strip packages/sample/hello/openfaas-examples
#patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 packages/sample/hello/openfaas-examples
cp ${pkgsCross.gnu64.pkgsHostHost.libffi.outPath}/lib64/libffi.so.8.1.2 packages/sample/hello/libffi.so.8
cp ${pkgsCross.gnu64.pkgsHostHost.gmp.outPath}/lib/libgmp.so.10.4.1 packages/sample/hello/libgmp.so.10
cp /nix/store/flf14c3ibr83jsa070j25hg5gjapydhl-glibc-2.37-8/lib/{libc.so.6,libm.so.6,librt.so.1,libdl.so.2,ld-linux-x86-64.so.2} packages/sample/hello/
patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 packages/sample/hello/libc.so.6
# wget -c https://raw.githubusercontent.com/oufm/packelf/master/packelf.sh
# chmod +x packelf.sh
# export GHC=${if builtins.currentSystem == "aarch64-linux" then "x86_64-unknown-linux-ghc" else "ghc"}
'';
} ""