pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / servers / mobilizon / default.nix
blobe4a75a4c91cebbfe792bf882ddf7865d5715cc41
1 { lib
2 , callPackage
3 , writeShellScriptBin
4 , beamPackages
5 , mix2nix
6 , fetchFromGitHub
7 , git
8 , cmake
9 , nixosTests
10 , mobilizon-frontend
11 , ...
14 let
15   inherit (beamPackages) mixRelease buildMix;
16   common = callPackage ./common.nix { };
18 mixRelease rec {
19   inherit (common) pname version src;
21   nativeBuildInputs = [ git cmake ];
23   mixNixDeps = import ./mix.nix {
24     inherit beamPackages lib;
25     overrides = (final: prev:
26       (lib.mapAttrs
27         (_: value: value.override {
28           appConfigPath = src + "/config";
29         })
30         prev) // {
31         fast_html = prev.fast_html.override {
32           nativeBuildInputs = [ cmake ];
33         };
34         ex_cldr = prev.ex_cldr.overrideAttrs (old: {
35           # We have to use the GitHub sources, as it otherwise tries to download
36           # the locales at build time.
37           src = fetchFromGitHub {
38             owner = "elixir-cldr";
39             repo = "cldr";
40             rev = "v${old.version}";
41             sha256 = assert old.version == "2.37.5";
42               "sha256-T5Qvuo+xPwpgBsqHNZYnTCA4loToeBn1LKTMsDcCdYs=";
43           };
44           postInstall = ''
45             cp $src/priv/cldr/locales/* $out/lib/erlang/lib/ex_cldr-${old.version}/priv/cldr/locales/
46           '';
47         });
48         # Upstream issue: https://github.com/bryanjos/geo_postgis/pull/87
49         geo_postgis = prev.geo_postgis.overrideAttrs (old: {
50           propagatedBuildInputs = old.propagatedBuildInputs ++ [ final.ecto ];
51         });
53         # The remainder are Git dependencies (and their deps) that are not supported by mix2nix currently.
54         web_push_encryption = buildMix rec {
55           name = "web_push_encryption";
56           version = "0.3.1";
57           src = fetchFromGitHub {
58             owner = "danhper";
59             repo = "elixir-web-push-encryption";
60             rev = "6e143dcde0a2854c4f0d72816b7ecab696432779";
61             sha256 = "sha256-Da+/28SPZuUQBi8fQj31zmMvhMrYUaQIW4U4E+mRtMg=";
62           };
63           beamDeps = with final; [ httpoison jose ];
64         };
65         icalendar = buildMix rec {
66           name = "icalendar";
67           version = "unstable-2022-04-10";
68           src = fetchFromGitHub {
69             owner = "tcitworld";
70             repo = name;
71             rev = "1033d922c82a7223db0ec138e2316557b70ff49f";
72             sha256 = "sha256-N3bJZznNazLewHS4c2B7LP1lgxd1wev+EWVlQ7rOwfU=";
73           };
74           beamDeps = with final; [ mix_test_watch ex_doc timex ];
75         };
76         rajska = buildMix rec {
77           name = "rajska";
78           version = "1.3.3";
79           src = fetchFromGitHub {
80             owner = "tcitworld";
81             repo = name;
82             rev = "0c036448e261e8be6a512581c592fadf48982d84";
83             sha256 = "sha256-4pfply1vTAIT2Xvm3kONmrCK05xKfXFvcb8EKoSCXBE=";
84           };
85           beamDeps = with final; [ ex_doc credo absinthe excoveralls hammer mock ];
86         };
87         exkismet = buildMix rec {
88           name = "exkismet";
89           version = "0.0.3";
90           src = fetchFromGitHub {
91             owner = "tcitworld";
92             repo = name;
93             rev = "8b5485fde00fafbde20f315bec387a77f7358334";
94             sha256 = "sha256-ttgCWoBKU7VTjZJBhZNtqVF4kN7psBr/qOeR65MbTqw=";
95           };
96           beamDeps = with final; [ httpoison ex_doc credo doctor dialyxir ];
97         };
99       });
100   };
102   # Install the compiled js part
103   preBuild =
104     ''
105       cp -a "${mobilizon-frontend}/static" ./priv
106       chmod 770 -R ./priv
107     '';
109   postBuild = ''
110     mix phx.digest --no-deps-check
111   '';
113   passthru = {
114     tests.smoke-test = nixosTests.mobilizon;
115     updateScript = writeShellScriptBin "update.sh" ''
116       set -eou pipefail
118       ${mix2nix}/bin/mix2nix '${src}/mix.lock' > pkgs/servers/mobilizon/mix.nix
119     '';
120     elixirPackage = beamPackages.elixir;
121   };
123   meta = with lib; {
124     description = "Mobilizon is an online tool to help manage your events, your profiles and your groups";
125     homepage = "https://joinmobilizon.org/";
126     license = licenses.agpl3Plus;
127     maintainers = with maintainers; [ minijackson erictapen ];
128   };