pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / servers / pleroma / default.nix
blob88b0f14741fc6cc4dfe1fe05c5b8061bb245ae73
2   lib,
3   stdenv,
4   beamPackages,
5   fetchFromGitHub,
6   fetchFromGitLab,
7   fetchHex,
8   file,
9   cmake,
10   nixosTests,
11   writeText,
12   vips,
13   pkg-config,
14   glib,
15   darwin,
16   ...
19 beamPackages.mixRelease rec {
20   pname = "pleroma";
21   version = "2.7.0";
23   src = fetchFromGitLab {
24     domain = "git.pleroma.social";
25     owner = "pleroma";
26     repo = "pleroma";
27     rev = "v${version}";
28     sha256 = "sha256-2uKVwjxMLC8jyZWW+ltBRNtOR7RaAb8SPO1iV2wyROc=";
29   };
31   patches = [ ./Revert-Config-Restrict-permissions-of-OTP-config.patch ];
33   mixNixDeps = import ./mix.nix {
34     inherit beamPackages lib;
35     overrides = final: prev: {
36       # mix2nix does not support git dependencies yet,
37       # so we need to add them manually
38       captcha = beamPackages.buildMix {
39         name = "captcha";
40         version = "0.1.0";
42         src = fetchFromGitLab {
43           domain = "git.pleroma.social";
44           owner = "pleroma/elixir-libraries";
45           repo = "elixir-captcha";
46           rev = "90f6ce7672f70f56708792a98d98bd05176c9176";
47           sha256 = "sha256-s7EuAhmCsQA/4p2NJHJSWB/DZ5hA+7EelPsUOvKr2Po=";
48         };
49         beamDeps = [ ];
50       };
51       prometheus_ex = beamPackages.buildMix {
52         name = "prometheus_ex";
53         version = "3.0.5";
55         src = fetchFromGitHub {
56           owner = "lanodan";
57           repo = "prometheus.ex";
58           rev = "31f7fbe4b71b79ba27efc2a5085746c4011ceb8f";
59           hash = "sha256-2PZP+YnwnHt69HtIAQvjMBqBbfdbkRSoMzb1AL2Zsyc=";
60         };
61         beamDeps = with final; [ prometheus ];
62       };
63       remote_ip = beamPackages.buildMix {
64         name = "remote_ip";
65         version = "0.1.5";
67         src = fetchFromGitLab {
68           domain = "git.pleroma.social";
69           owner = "pleroma/elixir-libraries";
70           repo = "remote_ip";
71           rev = "b647d0deecaa3acb140854fe4bda5b7e1dc6d1c8";
72           hash = "sha256-pgON0uhTPVeeAC866Qz24Jvm1okoAECAHJrRzqaq+zA=";
73         };
74         beamDeps = with final; [
75           combine
76           plug
77           inet_cidr
78         ];
79       };
80       majic = prev.majic.override { buildInputs = [ file ]; };
81       # Some additional build inputs and build fixes
82       http_signatures = prev.http_signatures.override {
83         patchPhase = ''
84           substituteInPlace mix.exs --replace ":logger" ":logger, :public_key"
85         '';
86       };
87       fast_html = prev.fast_html.override {
88         nativeBuildInputs = [ cmake ];
89         dontUseCmakeConfigure = true;
90       };
92       syslog = prev.syslog.override { buildPlugins = with beamPackages; [ pc ]; };
94       vix = prev.vix.override {
95         nativeBuildInputs = [ pkg-config ];
96         buildInputs =
97           [
98             vips
99             glib.dev
100           ]
101           ++ lib.optionals stdenv.isDarwin [
102             darwin.apple_sdk.frameworks.Foundation
103             darwin.apple_sdk.frameworks.AppKit
104             darwin.apple_sdk.frameworks.Kerberos
105           ];
106         VIX_COMPILATION_MODE = "PLATFORM_PROVIDED_LIBVIPS";
107       };
109       # This needs a different version (1.0.14 -> 1.0.18) to build properly with
110       # our Erlang/OTP version.
111       eimp = beamPackages.buildRebar3 rec {
112         name = "eimp";
113         version = "1.0.18";
115         src = beamPackages.fetchHex {
116           pkg = name;
117           inherit version;
118           sha256 = "0fnx2pm1n2m0zs2skivv43s42hrgpq9i143p9mngw9f3swjqpxvx";
119         };
121         patchPhase = ''
122           echo '{plugins, [pc]}.' >> rebar.config
123         '';
124         buildPlugins = with beamPackages; [ pc ];
126         beamDeps = with final; [ p1_utils ];
127       };
128       # Required by eimp
129       p1_utils = beamPackages.buildRebar3 rec {
130         name = "p1_utils";
131         version = "1.0.18";
133         src = fetchHex {
134           pkg = "${name}";
135           inherit version;
136           sha256 = "120znzz0yw1994nk6v28zql9plgapqpv51n9g6qm6md1f4x7gj0z";
137         };
139         beamDeps = [ ];
140       };
142       mime = prev.mime.override {
143         patchPhase =
144           let
145             cfgFile = writeText "config.exs" ''
146               use Mix.Config
147               config :mime, :types, %{
148                 "application/activity+json" => ["activity+json"],
149                 "application/jrd+json" => ["jrd+json"],
150                 "application/ld+json" => ["activity+json"],
151                 "application/xml" => ["xml"],
152                 "application/xrd+xml" => ["xrd+xml"]
153               }
154             '';
155           in
156           ''
157             mkdir config
158             cp ${cfgFile} config/config.exs
159           '';
160       };
161     };
162   };
164   passthru = {
165     tests.pleroma = nixosTests.pleroma;
166     inherit mixNixDeps;
167   };
169   meta = with lib; {
170     description = "ActivityPub microblogging server";
171     homepage = "https://git.pleroma.social/pleroma/pleroma";
172     license = licenses.agpl3Only;
173     maintainers = with maintainers; [
174       picnoir
175       kloenk
176       yayayayaka
177     ];
178     platforms = platforms.unix;
179   };