11 beamPackages.mixRelease rec {
15 src = fetchFromGitea {
16 domain = "akkoma.dev";
20 hash = "sha256-WZAkpJIPzAbqXawNiM3JqE9tJzxrNs/2dGAWVMwLpN4=";
24 # Remove dependency on OS_Mon
25 sed -E -i 's/(^|\s):os_mon,//' \
30 # Digest and compress static files
31 rm -f priv/static/READ_THIS_BEFORE_TOUCHING_FILES_HERE
32 mix phx.digest --no-deps-check
35 mixNixDeps = import ./mix.nix {
36 inherit beamPackages lib;
37 overrides = final: prev:
39 mimeTypePatchPhase = ''
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"]
50 Mix.Config.config :mime, :extensions, %{
51 "activity+json" => "text/plain",
52 "jrd+json" => "text/plain",
53 "xrd+xml" => "text/plain"
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;
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 {
72 src = fetchFromGitLab {
73 domain = "git.pleroma.social";
75 owner = "elixir-libraries";
76 repo = "elixir-captcha";
77 rev = "90f6ce7672f70f56708792a98d98bd05176c9176";
78 hash = "sha256-s7EuAhmCsQA/4p2NJHJSWB/DZ5hA+7EelPsUOvKr2Po=";
81 # the binary is not getting installed by default
82 postInstall = "mv priv/* $out/lib/erlang/lib/${name}-${version}/priv/";
84 concurrent_limiter = beamPackages.buildMix rec {
85 name = "concurrent_limiter";
88 src = fetchFromGitea {
89 domain = "akkoma.dev";
91 repo = "concurrent-limiter";
92 rev = "a9e0b3d64574bdba761f429bb4fba0cf687b3338";
93 hash = "sha256-A7ucZnXks4K+JDVY5vV2cT5KfEOUOo/OHO4rga5mGys=";
96 elasticsearch = beamPackages.buildMix rec {
97 name = "elasticsearch";
100 src = fetchFromGitea {
101 domain = "akkoma.dev";
102 owner = "AkkomaGang";
103 repo = "elasticsearch-elixir";
104 rev = "6cd946f75f6ab9042521a009d1d32d29a90113ca";
105 hash = "sha256-CtmQHVl+VTpemne+nxbkYGcErrgCo+t3ZBPbkFSpyF0=";
108 linkify = beamPackages.buildMix rec {
112 src = fetchFromGitea {
113 domain = "akkoma.dev";
114 owner = "AkkomaGang";
116 rev = "2567e2c1073fa371fd26fd66dfa5bc77b6919c16";
117 hash = "sha256-e3wzlbRuyw/UB5Tb7IozX/WR1T+sIBf9C/o5Thki9vg=";
120 mfm_parser = beamPackages.buildMix rec {
124 src = fetchFromGitea {
125 domain = "akkoma.dev";
126 owner = "AkkomaGang";
128 rev = "b21ab7754024af096f2d14247574f55f0063295b";
129 hash = "sha256-couG5jrAo0Fbk/WABd4n3vhXpDUp+9drxExKc5NM9CI=";
132 beamDeps = with final; [ phoenix_view temple ];
133 patchPhase = mimeTypePatchPhase;
135 search_parser = beamPackages.buildMix rec {
136 name = "search_parser";
139 src = fetchFromGitHub {
140 owner = "FloatingGhost";
141 repo = "pleroma-contrib-search-parser";
142 rev = "08971a81e68686f9ac465cfb6661d51c5e4e1e7f";
143 hash = "sha256-sbo9Kcp2oT05o2GAF+IgziLPYmCkWgBfFMBCytmqg3Y=";
146 beamDeps = with final; [ nimble_parsec ];
148 temple = beamPackages.buildMix rec {
150 version = "0.9.0-rc.0";
152 src = fetchFromGitea {
153 domain = "akkoma.dev";
154 owner = "AkkomaGang";
156 rev = "066a699ade472d8fa42a9d730b29a61af9bc8b59";
157 hash = "sha256-qA0z8WTMjO2OixcZBARn/LbuV3s3LGtwZ9nSjj/tWBc=";
161 beamDeps = with final; [ earmark_parser ex_doc makeup makeup_elixir makeup_erlang nimble_parsec ];
162 patchPhase = mimeTypePatchPhase;
165 # Some additional build inputs and build fixes
166 fast_html = prev.fast_html.override {
167 nativeBuildInputs = [ cmake ];
168 dontUseCmakeConfigure = true;
170 http_signatures = beamPackages.buildMix rec {
171 name = "http_signatures";
174 src = fetchFromGitea {
175 domain = "akkoma.dev";
176 owner = "AkkomaGang";
177 repo = "http_signatures";
178 rev = "6640ce7d24c783ac2ef56e27d00d12e8dc85f396";
179 hash = "sha256-Q/IoVbM/TBgGCmx8AxiBHF2hARb0FbPml8N1HjN3CsE=";
182 beamDeps = with final; [ credo ex_doc dialyxir temple ];
184 substituteInPlace mix.exs --replace ":logger" ":logger, :public_key"
185 ${mimeTypePatchPhase}
188 majic = beamPackages.buildMix {
192 src = fetchFromGitea {
193 domain = "akkoma.dev";
194 owner = "AkkomaGang";
196 rev = "80540b36939ec83f48e76c61e5000e0fd67706f0";
197 hash = "sha256-OMM9aDRvbqCOBIE+iPySU8ONRn1BqHDql22rRSmdW08=";
200 buildInputs = [ file ];
201 beamDeps = with final; [ nimble_pool mime plug credo dialyxir ex_doc elixir_make ];
202 patchPhase = mimeTypePatchPhase;
205 syslog = prev.syslog.override {
206 buildPlugins = with beamPackages; [ pc ];
212 tests = with nixosTests; { inherit akkoma akkoma-confined; };
215 # Used to make sure the service uses the same version of elixir as
217 elixirPackage = beamPackages.elixir;
221 description = "ActivityPub microblogging server";
222 homepage = "https://akkoma.social";
223 license = licenses.agpl3Only;
224 maintainers = with maintainers; [ mvs ];
225 platforms = platforms.unix;