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