-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
Expand file tree
/
Copy pathpackage.nix
More file actions
246 lines (224 loc) · 7.08 KB
/
package.nix
File metadata and controls
246 lines (224 loc) · 7.08 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
{
beam,
lib,
fetchFromGitHub,
fetchFromForgejo,
fetchHex,
file,
cmake,
nixosTests,
writeText,
vips,
pkg-config,
glib,
fetchpatch,
}:
let
beamPackages = beam.packages.erlang_27.extend (self: super: { elixir = self.elixir_1_18; });
in
beamPackages.mixRelease rec {
pname = "pleroma";
version = "2.10.2";
src = fetchFromForgejo {
domain = "git.pleroma.social";
owner = "pleroma";
repo = "pleroma";
rev = "v${version}";
sha256 = "sha256-5BFzV2alNDjO/bS08+V4idzFaXQLr+4pNlLLXayBqIE=";
};
patches = [ ./Revert-Config-Restrict-permissions-of-OTP-config.patch ];
mixNixDeps = import ./mix.nix {
inherit beamPackages lib;
overrides = final: prev: {
# Upstream is pointing to
# https://github.com/feld/phoenix/commits/v1.7.14-websocket-headers/
# which is v1.7.14 with an extra patch applied on top.
phoenix = beamPackages.buildMix {
name = "phoenix";
version = "1.7.14-websocket-headers";
src = fetchFromGitHub {
owner = "phoenixframework";
repo = "phoenix";
tag = "v1.7.14";
hash = "sha256-hb8k0bUl28re1Bv2AIs17VHOP8zIyCfbpaVydu1Dh24=";
};
patches = [
(fetchpatch {
name = "0001-Support-passing-through-the-value-of-the-sec-websocket-protocol-header.patch";
url = "https://github.com/feld/phoenix/commit/fb6dc76c657422e49600896c64aab4253fceaef6.patch";
hash = "sha256-eMla+D3EcVTc1WwlRaKvLPV5eXwGfAgZOxiYlGSkBIQ=";
})
];
beamDeps = with final; [
phoenix_pubsub
plug
plug_crypto
telemetry
phoenix_template
websock_adapter
phoenix_view
castore
plug_cowboy
jason
];
};
# mix2nix does not support git dependencies yet,
# so we need to add them manually
captcha = beamPackages.buildMix {
name = "captcha";
version = "0.1.0";
src = fetchFromForgejo {
domain = "git.pleroma.social";
owner = "pleroma/elixir-libraries";
repo = "elixir-captcha";
rev = "e7b7cc34cc16b383461b966484c297e4ec9aeef6";
sha256 = "sha256-gcsZ8BzmKfSeX2QsWDxQd34nKxIM0eJKBAaxxYyFSlg=";
};
beamDeps = [ ];
};
prometheus_ex = beamPackages.buildMix {
name = "prometheus_ex";
version = "3.0.5";
src = fetchFromGitHub {
owner = "lanodan";
repo = "prometheus.ex";
rev = "31f7fbe4b71b79ba27efc2a5085746c4011ceb8f";
hash = "sha256-2PZP+YnwnHt69HtIAQvjMBqBbfdbkRSoMzb1AL2Zsyc=";
};
beamDeps = with final; [ prometheus ];
};
oban_plugins_lazarus = beamPackages.buildMix {
name = "oban_plugins_lazarus";
version = "0.1.0";
src = fetchFromForgejo {
domain = "git.pleroma.social";
owner = "pleroma/elixir-libraries";
repo = "oban_plugins_lazarus";
rev = "e49fc355baaf0e435208bf5f534d31e26e897711";
hash = "sha256-zSzPniRN7jQLAEGGOuwserDSLy2lSZ74NFMD/IOBsC8=";
};
beamDeps = with final; [ oban ];
};
remote_ip = beamPackages.buildMix {
name = "remote_ip";
version = "0.1.5";
src = fetchFromForgejo {
domain = "git.pleroma.social";
owner = "pleroma/elixir-libraries";
repo = "remote_ip";
rev = "b647d0deecaa3acb140854fe4bda5b7e1dc6d1c8";
hash = "sha256-pgON0uhTPVeeAC866Qz24Jvm1okoAECAHJrRzqaq+zA=";
};
beamDeps = with final; [
combine
plug
inet_cidr
];
};
majic = prev.majic.override { buildInputs = [ file ]; };
# Some additional build inputs and build fixes
http_signatures = prev.http_signatures.override {
patchPhase = ''
substituteInPlace mix.exs --replace ":logger" ":logger, :public_key"
'';
};
fast_html = prev.fast_html.override {
nativeBuildInputs = [ cmake ];
dontUseCmakeConfigure = true;
};
syslog = prev.syslog.override { buildPlugins = with beamPackages; [ pc ]; };
phoenix_live_view = prev.phoenix_live_view.override {
# This listener breaks with elixir 1.18.
# It's only using for dev, let's remove it.
postPatch = ''
sed -i '/listeners: \[Phoenix.CodeReloader\]/d' mix.exs
'';
};
oban_web = prev.oban_web.override {
# This listener breaks with elixir 1.18.
# It's only using for dev, let's remove it.
postPatch = ''
sed -i '/listeners: \[Phoenix.CodeReloader\]/d' mix.exs
'';
};
vix = prev.vix.override {
nativeBuildInputs = [ pkg-config ];
buildInputs = [
vips
glib.dev
];
VIX_COMPILATION_MODE = "PLATFORM_PROVIDED_LIBVIPS";
};
# This needs a different version (1.0.14 -> 1.0.18) to build properly with
# our Erlang/OTP version.
eimp = beamPackages.buildRebar3 rec {
name = "eimp";
version = "1.0.18";
src = beamPackages.fetchHex {
pkg = name;
inherit version;
sha256 = "0fnx2pm1n2m0zs2skivv43s42hrgpq9i143p9mngw9f3swjqpxvx";
};
patchPhase = ''
echo '{plugins, [pc]}.' >> rebar.config
'';
buildPlugins = with beamPackages; [ pc ];
beamDeps = with final; [ p1_utils ];
};
# Required by eimp
p1_utils = beamPackages.buildRebar3 rec {
name = "p1_utils";
version = "1.0.18";
src = fetchHex {
pkg = "${name}";
inherit version;
sha256 = "120znzz0yw1994nk6v28zql9plgapqpv51n9g6qm6md1f4x7gj0z";
};
beamDeps = [ ];
};
mime = prev.mime.override {
patchPhase =
let
cfgFile = writeText "config.exs" ''
use Mix.Config
config :mime, :types, %{
"application/activity+json" => ["activity+json"],
"application/jrd+json" => ["jrd+json"],
"application/ld+json" => ["activity+json"],
"application/xml" => ["xml"],
"application/xrd+xml" => ["xrd+xml"]
}
'';
in
''
mkdir config
cp ${cfgFile} config/config.exs
'';
};
# mochiweb is unused by still in mix.lock
# work around OTP 27+ incompat by forcing our build to use a newer version
mochiweb = prev.mochiweb.override rec {
version = "3.3.0";
src = fetchHex {
pkg = "mochiweb";
version = "${version}";
sha256 = "sha256-qoW3d/sj6ZcuvEJOQLXTUQbxm8mYhz4Cbe3Ydt+O5Qw=";
};
};
};
};
passthru = {
tests.pleroma = nixosTests.pleroma;
inherit mixNixDeps;
};
meta = {
description = "ActivityPub microblogging server";
homepage = "https://git.pleroma.social/pleroma/pleroma";
license = lib.licenses.agpl3Only;
maintainers = with lib.maintainers; [
picnoir
kloenk
];
platforms = lib.platforms.unix;
};
}