forked from serokell/foundry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
88 lines (78 loc) · 2.08 KB
/
default.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
let
nixpkgsPin = import ./nix/nixpkgs-pin.nix;
in
{ pkgs ? import (builtins.fetchTarball nixpkgsPin) {},
hc ? "ghc8107"
}:
let
sdam_from_github =
pkgs.fetchFromGitHub {
owner = "int-index";
repo = "sdam";
rev = "3943cd2662eff11e1a36bc629ac832652ec43a6e";
sha256 = "05p43wvmx41rlnj5nwlcngr8rxhms5dxlh210ag2r04gxwra2mrv";
};
slay_from_github =
pkgs.fetchFromGitHub {
owner = "int-index";
repo = "slay";
rev = "1c9d39b8cb4f32f0b4778677c21ebb85cc1cddf7";
sha256 = "0x9xqaykdw5z3ggi7mkm7f5605c7z4jalhydvf9p1asdi5i34f8j";
};
haskell_inputs = p: [
p.gtk3
p.lens
p.dlist
p.ghc-lib-parser
p.megaparsec
p.inj
p.inj-base
p.regex-applicative
p.split
p.streams
p.sdam
p.slay-core
p.slay-combinators
p.slay-cairo
];
haskellPackages =
pkgs.haskell.packages.${hc}.override {
overrides = self: super: rec {
sdam = self.callCabal2nix "sdam" sdam_from_github {};
slay-core = self.callCabal2nix "slay-core" "${slay_from_github}/core" {};
slay-combinators = self.callCabal2nix "slay-combinators" "${slay_from_github}/combinators" {};
slay-cairo = self.callCabal2nix "slay-cairo" "${slay_from_github}/cairo" {};
};
};
in
pkgs.stdenv.mkDerivation rec {
name = "foundry";
src = ./.;
buildCommand = ''
mkdir -p $out/bin $out/home
cp -r $src/foundry.cabal $src/src .
HOME=$out/home \
cabal --offline --config-file /dev/null v2-install \
--builddir=$out/dist \
--installdir=$out/bin \
exe:foundry exe:morte-to-sdam exe:hask exe:haskell-to-sdam exe:sdam-to-svg
'';
buildInputs = [
(haskellPackages.ghcWithPackages haskell_inputs)
pkgs.cabal-install
pkgs.git
pkgs.zlib
pkgs.pkgconfig
pkgs.cairo
pkgs.pango
pkgs.gtk3
];
shellHook = ''
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath buildInputs}:$LD_LIBRARY_PATH
export LANG=en_US.UTF-8
'';
LOCALE_ARCHIVE =
if pkgs.stdenv.isLinux
then "${pkgs.glibcLocales}/lib/locale/locale-archive"
else "";
}