Merge pull request #330634 from r-ryantm/auto-update/circumflex
[NixPkgs.git] / pkgs / servers / pleroma / default.nix
blob15382071602f4b06a40639899e32fe0147fde378
1 { lib, beamPackages
2 , fetchFromGitHub, fetchFromGitLab, fetchHex
3 , file, cmake
4 , nixosTests, writeText
5 , ...
6 }:
8 beamPackages.mixRelease rec {
9   pname = "pleroma";
10   version = "2.6.3";
12   src = fetchFromGitLab {
13     domain = "git.pleroma.social";
14     owner = "pleroma";
15     repo = "pleroma";
16     rev = "v${version}";
17     sha256 = "sha256-ZiupcCu6ES/G9rsdNo5+JXOIPhb4CHT2YhKThWiLisw=";
18   };
20   patches = [
21     ./Revert-Config-Restrict-permissions-of-OTP-config.patch
22   ];
24   mixNixDeps = import ./mix.nix {
25     inherit beamPackages lib;
26     overrides = final: prev: {
27       # mix2nix does not support git dependencies yet,
28       # so we need to add them manually
29       prometheus_ex = beamPackages.buildMix rec {
30         name = "prometheus_ex";
31         version = "3.0.5";
33         src = fetchFromGitHub {
34           owner = "lanodan";
35           repo = "prometheus.ex";
36           rev = "31f7fbe4b71b79ba27efc2a5085746c4011ceb8f";
37           sha256 = "sha256-2PZP+YnwnHt69HtIAQvjMBqBbfdbkRSoMzb1AL2Zsyc=";
38         };
39         beamDeps = with final; [ prometheus ];
40       };
41       captcha = beamPackages.buildMix rec {
42         name = "captcha";
43         version = "0.1.0";
45         src = fetchFromGitLab {
46           domain = "git.pleroma.social";
47           group = "pleroma";
48           owner = "elixir-libraries";
49           repo = "elixir-captcha";
50           rev = "90f6ce7672f70f56708792a98d98bd05176c9176";
51           hash = "sha256-s7EuAhmCsQA/4p2NJHJSWB/DZ5hA+7EelPsUOvKr2Po=";
52         };
53         beamDeps = with final; [ ];
55         postInstall = "mv priv/* $out/lib/erlang/lib/${name}-${version}/priv/";
56       };
57       remote_ip = beamPackages.buildMix rec {
58         name = "remote_ip";
59         version = "0.1.5";
61         src = fetchFromGitLab {
62           domain = "git.pleroma.social";
63           group = "pleroma";
64           owner = "elixir-libraries";
65           repo = "remote_ip";
66           rev = "b647d0deecaa3acb140854fe4bda5b7e1dc6d1c8";
67           sha256 = "0c7vmakcxlcs3j040018i7bfd6z0yq6fjfig02g5fgakx398s0x6";
68         };
69         beamDeps = with final; [ combine plug inet_cidr ];
70       };
71       prometheus_phx = beamPackages.buildMix rec {
72         name = "prometheus_phx";
73         version = "0.1.1";
75         preBuild = ''
76           touch config/prod.exs
77        '';
78         src = fetchFromGitLab {
79           domain = "git.pleroma.social";
80           group = "pleroma";
81           owner = "elixir-libraries";
82           repo = "prometheus-phx";
83           rev = "9cd8f248c9381ffedc799905050abce194a97514";
84           sha256 = "0211z4bxb0bc0zcrhnph9kbbvvi1f2v95madpr96pqzr60y21cam";
85         };
86         beamDeps = with final; [ prometheus_ex ];
87       };
88       majic = prev.majic.override {
89         buildInputs = [ file ];
90       };
91       # Some additional build inputs and build fixes
92       http_signatures = prev.http_signatures.override {
93         patchPhase = ''
94           substituteInPlace mix.exs --replace ":logger" ":logger, :public_key"
95         '';
96       };
97       fast_html = prev.fast_html.override {
98         nativeBuildInputs = [ cmake ];
99         dontUseCmakeConfigure = true;
100       };
101       syslog = prev.syslog.override {
102         buildPlugins = with beamPackages; [ pc ];
103       };
105       # This needs a different version (1.0.14 -> 1.0.18) to build properly with
106       # our Erlang/OTP version.
107       eimp = beamPackages.buildRebar3 rec {
108         name = "eimp";
109         version = "1.0.18";
111         src = beamPackages.fetchHex {
112           pkg = name;
113           inherit version;
114           sha256 = "0fnx2pm1n2m0zs2skivv43s42hrgpq9i143p9mngw9f3swjqpxvx";
115         };
117         patchPhase = ''
118           echo '{plugins, [pc]}.' >> rebar.config
119         '';
120         buildPlugins = with beamPackages; [ pc ];
122         beamDeps = with final; [ p1_utils ];
123       };
124       # Required by eimp
125       p1_utils = beamPackages.buildRebar3 rec {
126         name = "p1_utils";
127         version = "1.0.18";
129         src = fetchHex {
130           pkg = "${name}";
131           inherit version;
132           sha256 = "120znzz0yw1994nk6v28zql9plgapqpv51n9g6qm6md1f4x7gj0z";
133         };
135         beamDeps = [];
136       };
138       mime = prev.mime.override {
139         patchPhase = let
140           cfgFile = writeText "config.exs" ''
141             use Mix.Config
142             config :mime, :types, %{
143               "application/activity+json" => ["activity+json"],
144               "application/jrd+json" => ["jrd+json"],
145               "application/ld+json" => ["activity+json"],
146               "application/xml" => ["xml"],
147               "application/xrd+xml" => ["xrd+xml"]
148             }
149           '';
150         in ''
151           mkdir config
152           cp ${cfgFile} config/config.exs
153         '';
154       };
155     };
156   };
158   passthru = {
159     tests.pleroma = nixosTests.pleroma;
160     inherit mixNixDeps;
161   };
163   meta = with lib; {
164     description = "ActivityPub microblogging server";
165     homepage = "https://git.pleroma.social/pleroma/pleroma";
166     license = licenses.agpl3Only;
167     maintainers = with maintainers; [ picnoir kloenk yayayayaka ];
168     platforms = platforms.unix;
169   };