12 beamPackages.mixRelease rec {
16 src = fetchFromGitea {
17 domain = "akkoma.dev";
21 hash = "sha256-WZAkpJIPzAbqXawNiM3JqE9tJzxrNs/2dGAWVMwLpN4=";
25 # Remove dependency on OS_Mon
26 sed -E -i 's/(^|\s):os_mon,//' \
31 # Digest and compress static files
32 rm -f priv/static/READ_THIS_BEFORE_TOUCHING_FILES_HERE
33 mix phx.digest --no-deps-check
36 mixNixDeps = import ./mix.nix {
37 inherit beamPackages lib;
38 overrides = final: prev:
40 mimeTypePatchPhase = ''
42 cat >> config/config.exs <<EOF
43 Mix.Config.config :mime, :types, %{
44 "application/xml" => ["xml"],
45 "application/xrd+xml" => ["xrd+xml"],
46 "application/jrd+json" => ["jrd+json"],
47 "application/activity+json" => ["activity+json"],
48 "application/ld+json" => ["activity+json"],
49 "image/apng" => ["apng"]
51 Mix.Config.config :mime, :extensions, %{
52 "activity+json" => "text/plain",
53 "jrd+json" => "text/plain",
54 "xrd+xml" => "text/plain"
58 # Akkoma adds some things to the `mime` package's configuration, which requires it to be recompiled.
59 # However, we can't just recompile things like we would on other systems.
60 # 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.
61 # 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`.
62 addMimeTypes = _: p: p.override {
63 patchPhase = mimeTypePatchPhase;
66 (lib.attrsets.mapAttrs addMimeTypes prev) // {
67 # mix2nix does not support git dependencies yet,
68 # so we need to add them manually
69 captcha = beamPackages.buildMix rec {
73 src = fetchFromGitLab {
74 domain = "git.pleroma.social";
76 owner = "elixir-libraries";
77 repo = "elixir-captcha";
78 rev = "90f6ce7672f70f56708792a98d98bd05176c9176";
79 hash = "sha256-s7EuAhmCsQA/4p2NJHJSWB/DZ5hA+7EelPsUOvKr2Po=";
82 # the binary is not getting installed by default
83 postInstall = "mv priv/* $out/lib/erlang/lib/${name}-${version}/priv/";
85 concurrent_limiter = beamPackages.buildMix rec {
86 name = "concurrent_limiter";
89 src = fetchFromGitea {
90 domain = "akkoma.dev";
92 repo = "concurrent-limiter";
93 rev = "a9e0b3d64574bdba761f429bb4fba0cf687b3338";
94 hash = "sha256-A7ucZnXks4K+JDVY5vV2cT5KfEOUOo/OHO4rga5mGys=";
97 elasticsearch = beamPackages.buildMix rec {
98 name = "elasticsearch";
101 src = fetchFromGitea {
102 domain = "akkoma.dev";
103 owner = "AkkomaGang";
104 repo = "elasticsearch-elixir";
105 rev = "6cd946f75f6ab9042521a009d1d32d29a90113ca";
106 hash = "sha256-CtmQHVl+VTpemne+nxbkYGcErrgCo+t3ZBPbkFSpyF0=";
109 linkify = beamPackages.buildMix rec {
113 src = fetchFromGitea {
114 domain = "akkoma.dev";
115 owner = "AkkomaGang";
117 rev = "2567e2c1073fa371fd26fd66dfa5bc77b6919c16";
118 hash = "sha256-e3wzlbRuyw/UB5Tb7IozX/WR1T+sIBf9C/o5Thki9vg=";
121 mfm_parser = beamPackages.buildMix rec {
125 src = fetchFromGitea {
126 domain = "akkoma.dev";
127 owner = "AkkomaGang";
129 rev = "b21ab7754024af096f2d14247574f55f0063295b";
130 hash = "sha256-couG5jrAo0Fbk/WABd4n3vhXpDUp+9drxExKc5NM9CI=";
133 beamDeps = with final; [ phoenix_view temple ];
134 patchPhase = mimeTypePatchPhase;
136 search_parser = beamPackages.buildMix rec {
137 name = "search_parser";
140 src = fetchFromGitHub {
141 owner = "FloatingGhost";
142 repo = "pleroma-contrib-search-parser";
143 rev = "08971a81e68686f9ac465cfb6661d51c5e4e1e7f";
144 hash = "sha256-sbo9Kcp2oT05o2GAF+IgziLPYmCkWgBfFMBCytmqg3Y=";
147 beamDeps = with final; [ nimble_parsec ];
149 temple = beamPackages.buildMix rec {
151 version = "0.9.0-rc.0";
153 src = fetchFromGitea {
154 domain = "akkoma.dev";
155 owner = "AkkomaGang";
157 rev = "066a699ade472d8fa42a9d730b29a61af9bc8b59";
158 hash = "sha256-qA0z8WTMjO2OixcZBARn/LbuV3s3LGtwZ9nSjj/tWBc=";
162 beamDeps = with final; [ earmark_parser ex_doc makeup makeup_elixir makeup_erlang nimble_parsec ];
163 patchPhase = mimeTypePatchPhase;
166 # Some additional build inputs and build fixes
167 fast_html = prev.fast_html.override {
168 nativeBuildInputs = [ cmake ];
169 dontUseCmakeConfigure = true;
171 http_signatures = beamPackages.buildMix rec {
172 name = "http_signatures";
175 src = fetchFromGitea {
176 domain = "akkoma.dev";
177 owner = "AkkomaGang";
178 repo = "http_signatures";
179 rev = "6640ce7d24c783ac2ef56e27d00d12e8dc85f396";
180 hash = "sha256-Q/IoVbM/TBgGCmx8AxiBHF2hARb0FbPml8N1HjN3CsE=";
183 beamDeps = with final; [ credo ex_doc dialyxir temple ];
185 substituteInPlace mix.exs --replace ":logger" ":logger, :public_key"
186 ${mimeTypePatchPhase}
189 majic = beamPackages.buildMix {
193 src = fetchFromGitea {
194 domain = "akkoma.dev";
195 owner = "AkkomaGang";
197 rev = "80540b36939ec83f48e76c61e5000e0fd67706f0";
198 hash = "sha256-OMM9aDRvbqCOBIE+iPySU8ONRn1BqHDql22rRSmdW08=";
201 buildInputs = [ file ];
202 beamDeps = with final; [ nimble_pool mime plug credo dialyxir ex_doc elixir_make ];
203 patchPhase = mimeTypePatchPhase;
206 syslog = prev.syslog.override {
207 buildPlugins = with beamPackages; [ pc ];
213 tests = with nixosTests; { inherit akkoma akkoma-confined; };
216 # Used to make sure the service uses the same version of elixir as
218 elixirPackage = beamPackages.elixir;
222 description = "ActivityPub microblogging server";
223 homepage = "https://akkoma.social";
224 license = licenses.agpl3Only;
225 maintainers = with maintainers; [ mvs ];
226 platforms = platforms.unix;