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