1- { lib
2- , beamPackages
3- , fetchFromGitea
4- , fetchFromGitHub
5- , fetchFromGitLab
6- , cmake
7- , file
8- , nixosTests
9- , ...
1+ {
2+ lib ,
3+ beamPackages ,
4+ fetchFromGitea ,
5+ cmake ,
6+ file ,
7+ nixosTests ,
8+ nix-update-script ,
109} :
10+
1111beamPackages . mixRelease rec {
1212 pname = "akkoma" ;
13- version = "3.14 .1" ;
13+ version = "3.15 .1" ;
1414
1515 src = fetchFromGitea {
1616 domain = "akkoma.dev" ;
1717 owner = "AkkomaGang" ;
1818 repo = "akkoma" ;
19- rev = "v${ version } " ;
20- hash = "sha256-Ygb51jQatdyX/DzJk84X1AEliBGD938f83UnI5OqBPM=" ;
19+ tag = "v${ version } " ;
20+ hash = "sha256-6qsqTguEVu9t6dW8c+VAE5Z7D3FbQ0S2ZfAN5qy7Xak=" ;
21+ } ;
22+
23+ nativeBuildInputs = [ cmake ] ;
24+ buildInputs = [ file ] ;
25+
26+ mixFodDeps = beamPackages . fetchMixDeps {
27+ pname = "mix-deps-${ pname } " ;
28+ inherit src version ;
29+ hash = "sha256-nWtY5eohP9pv/vS9FuCh2nlPxLJ2Y4IRmve5in328DU=" ;
30+
31+ postInstall = ''
32+ substituteInPlace "$out/http_signatures/mix.exs" \
33+ --replace-fail ":logger" ":logger, :public_key"
34+
35+ # Akkoma adds some things to the `mime` package's configuration, which
36+ # requires it to be recompiled. However, we can't just recompile things
37+ # like we would on other systems. Therefore, we need to add it to mime's
38+ # compile-time config too, and also in every package that depends on
39+ # mime, directly or indirectly. We take the lazy way out and just add it
40+ # to every dependency – it won't make a difference in packages that don't
41+ # depend on `mime`.
42+ for dep in "$out/"*; do
43+ mkdir -p "$dep/config"
44+ cat ${ ./mime.exs } >>"$dep/config/config.exs"
45+ done
46+ '' ;
2147 } ;
2248
2349 postPatch = ''
@@ -26,183 +52,26 @@ beamPackages.mixRelease rec {
2652 mix.exs
2753 '' ;
2854
55+ dontUseCmakeConfigure = true ;
56+
2957 postBuild = ''
3058 # Digest and compress static files
3159 rm -f priv/static/READ_THIS_BEFORE_TOUCHING_FILES_HERE
32- mix phx.digest --no-compile
60+ mix do deps.loadpaths --no-deps-check, phx.digest --no-compile
3361 '' ;
3462
35- mixNixDeps = import ./mix.nix {
36- inherit beamPackages lib ;
37- overrides = final : prev :
38- let
39- mimeTypePatchPhase = ''
40- mkdir -p config
41- cat >> config/config.exs <<EOF
42- Mix.Config.config :mime, :types, %{
43- "application/xml" => ["xml"],
44- "application/xrd+xml" => ["xrd+xml"],
45- "application/jrd+json" => ["jrd+json"],
46- "application/activity+json" => ["activity+json"],
47- "application/ld+json" => ["activity+json"],
48- "image/apng" => ["apng"]
49- }
50- Mix.Config.config :mime, :extensions, %{
51- "activity+json" => "text/plain",
52- "jrd+json" => "text/plain",
53- "xrd+xml" => "text/plain"
54- }
55- EOF
56- '' ;
57- # Akkoma adds some things to the `mime` package's configuration, which requires it to be recompiled.
58- # However, we can't just recompile things like we would on other systems.
59- # Therefore, we need to add it to mime's compile-time config too, and also in every package that depends on mime, directly or indirectly.
60- # We take the lazy way out and just add it to every dependency - it won't make a difference in packages that don't depend on `mime`.
61- addMimeTypes = _ : p : p . override {
62- patchPhase = mimeTypePatchPhase ;
63- } ;
64- in
65- ( lib . attrsets . mapAttrs addMimeTypes prev ) // {
66- # mix2nix does not support git dependencies yet,
67- # so we need to add them manually
68- captcha = beamPackages . buildMix rec {
69- name = "captcha" ;
70- version = "0.1.0" ;
71-
72- src = fetchFromGitLab {
73- domain = "git.pleroma.social" ;
74- group = "pleroma" ;
75- owner = "elixir-libraries" ;
76- repo = "elixir-captcha" ;
77- rev = "6630c42aaaab124e697b4e513190c89d8b64e410" ;
78- hash = "sha256-KLsKBfCt6bUylSTTqRQi6ic0MyimanvIZRhU4Iv5Fmw=" ;
79- } ;
80-
81- # the binary is not getting installed by default
82- postInstall = "mv priv/* $out/lib/erlang/lib/${ name } -${ version } /priv/" ;
83- } ;
84- concurrent_limiter = beamPackages . buildMix rec {
85- name = "concurrent_limiter" ;
86- version = "0.1.1" ;
87-
88- src = fetchFromGitea {
89- domain = "akkoma.dev" ;
90- owner = "AkkomaGang" ;
91- repo = "concurrent-limiter" ;
92- rev = "a9e0b3d64574bdba761f429bb4fba0cf687b3338" ;
93- hash = "sha256-A7ucZnXks4K+JDVY5vV2cT5KfEOUOo/OHO4rga5mGys=" ;
94- } ;
95- } ;
96- elasticsearch = beamPackages . buildMix rec {
97- name = "elasticsearch" ;
98- version = "1.0.1" ;
99-
100- src = fetchFromGitea {
101- domain = "akkoma.dev" ;
102- owner = "AkkomaGang" ;
103- repo = "elasticsearch-elixir" ;
104- rev = "6cd946f75f6ab9042521a009d1d32d29a90113ca" ;
105- hash = "sha256-CtmQHVl+VTpemne+nxbkYGcErrgCo+t3ZBPbkFSpyF0=" ;
106- } ;
107- } ;
108- mfm_parser = beamPackages . buildMix rec {
109- name = "mfm_parser" ;
110- version = "0.1.0" ;
111-
112- src = fetchFromGitea {
113- domain = "akkoma.dev" ;
114- owner = "AkkomaGang" ;
115- repo = "mfm-parser" ;
116- rev = "b21ab7754024af096f2d14247574f55f0063295b" ;
117- hash = "sha256-couG5jrAo0Fbk/WABd4n3vhXpDUp+9drxExKc5NM9CI=" ;
118- } ;
119-
120- beamDeps = with final ; [ phoenix_view temple ] ;
121- patchPhase = mimeTypePatchPhase ;
122- } ;
123- search_parser = beamPackages . buildMix rec {
124- name = "search_parser" ;
125- version = "0.1.0" ;
126-
127- src = fetchFromGitHub {
128- owner = "FloatingGhost" ;
129- repo = "pleroma-contrib-search-parser" ;
130- rev = "08971a81e68686f9ac465cfb6661d51c5e4e1e7f" ;
131- hash = "sha256-sbo9Kcp2oT05o2GAF+IgziLPYmCkWgBfFMBCytmqg3Y=" ;
132- } ;
133-
134- beamDeps = with final ; [ nimble_parsec ] ;
135- } ;
136- temple = beamPackages . buildMix rec {
137- name = "temple" ;
138- version = "0.9.0-rc.0" ;
139-
140- src = fetchFromGitea {
141- domain = "akkoma.dev" ;
142- owner = "AkkomaGang" ;
143- repo = "temple" ;
144- rev = "066a699ade472d8fa42a9d730b29a61af9bc8b59" ;
145- hash = "sha256-qA0z8WTMjO2OixcZBARn/LbuV3s3LGtwZ9nSjj/tWBc=" ;
146- } ;
147-
148- mixEnv = "dev" ;
149- beamDeps = with final ; [ earmark_parser ex_doc makeup makeup_elixir makeup_erlang nimble_parsec ] ;
150- patchPhase = mimeTypePatchPhase ;
151- } ;
152-
153- # Some additional build inputs and build fixes
154- fast_html = prev . fast_html . override {
155- nativeBuildInputs = [ cmake ] ;
156- dontUseCmakeConfigure = true ;
157- } ;
158- http_signatures = beamPackages . buildMix rec {
159- name = "http_signatures" ;
160- version = "0.1.3" ;
161-
162- src = fetchFromGitea {
163- domain = "akkoma.dev" ;
164- owner = "AkkomaGang" ;
165- repo = "http_signatures" ;
166- rev = "d44c43d66758c6a73eaa4da9cffdbee0c5da44ae" ;
167- hash = "sha256-o5xF++AIJLVMFuQwldNyWpYJGWFHZZTfGy1V80TZzR8=" ;
168- } ;
169-
170- beamDeps = with final ; [ credo ex_doc dialyxir temple ] ;
171- patchPhase = ''
172- substituteInPlace mix.exs --replace ":logger" ":logger, :public_key"
173- ${ mimeTypePatchPhase }
174- '' ;
175- } ;
176- majic = beamPackages . buildMix {
177- name = "majic" ;
178- version = "1.0.0" ;
179-
180- src = fetchFromGitea {
181- domain = "akkoma.dev" ;
182- owner = "AkkomaGang" ;
183- repo = "majic" ;
184- rev = "80540b36939ec83f48e76c61e5000e0fd67706f0" ;
185- hash = "sha256-OMM9aDRvbqCOBIE+iPySU8ONRn1BqHDql22rRSmdW08=" ;
186- } ;
187-
188- buildInputs = [ file ] ;
189- beamDeps = with final ; [ nimble_pool mime plug credo dialyxir ex_doc elixir_make ] ;
190- patchPhase = mimeTypePatchPhase ;
191- } ;
192-
193- syslog = prev . syslog . override {
194- buildPlugins = with beamPackages ; [ pc ] ;
195- } ;
196- } ;
197- } ;
198-
19963 passthru = {
200- tests = with nixosTests ; { inherit akkoma akkoma-confined ; } ;
201- inherit mixNixDeps ;
64+ tests = with nixosTests ; {
65+ inherit akkoma akkoma-confined ;
66+ } ;
67+
68+ inherit mixFodDeps ;
20269
20370 # Used to make sure the service uses the same version of elixir as
20471 # the package
20572 elixirPackage = beamPackages . elixir ;
73+
74+ updateScript = nix-update-script { } ;
20675 } ;
20776
20877 meta = {
0 commit comments