This repository has been archived on 2024-10-13. You can view files and clone it, but cannot push or open issues or pull requests.
nix-packages/akkoma/default.nix

229 lines
6.9 KiB
Nix
Raw Normal View History

2022-09-09 10:36:29 +00:00
{
2022-09-25 13:06:44 +00:00
lib,
beamPackages,
fetchFromGitea,
fetchFromGitHub,
fetchFromGitLab,
cmake,
file,
writeText,
writeScript,
applyPatches,
2022-10-23 10:12:24 +00:00
libxcrypt,
2022-09-25 13:06:44 +00:00
...
}: let
source = builtins.fromJSON (builtins.readFile ./source.json);
src = applyPatches {
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "akkoma";
inherit (source) rev sha256;
};
patches = [./akkoma.patch];
};
in
beamPackages.mixRelease rec {
2022-09-14 19:04:58 +00:00
pname = "akkoma";
2022-09-25 13:06:44 +00:00
version = source.date;
2022-09-09 09:30:32 +00:00
2022-09-25 13:06:44 +00:00
inherit src;
# Correct version number and remove dependency on OS_Mon
postPatch = ''
sed -E -i \
-e 's/(version\(")\d+\.\d+\.\d+("\))/\1${version}\2/' \
-e 's/(^|\s):os_mon,//' \
mix.exs
'';
# cf. https://github.com/whitfin/cachex/issues/205
2022-09-24 08:03:44 +00:00
stripDebug = false;
2022-09-09 09:30:32 +00:00
2022-09-14 19:04:58 +00:00
mixNixDeps = import ./mix.nix {
inherit beamPackages lib;
overrides = final: prev: {
# mix2nix does not support git dependencies yet,
# so we need to add them manually
captcha = beamPackages.buildMix rec {
name = "captcha";
version = "0.1.0";
2022-09-09 09:30:32 +00:00
2022-09-14 19:04:58 +00:00
src = fetchFromGitLab {
domain = "git.pleroma.social";
group = "pleroma";
owner = "elixir-libraries";
repo = "elixir-captcha";
rev = "e0f16822d578866e186a0974d65ad58cddc1e2ab";
sha256 = "0qbf86l59kmpf1nd82v4141ba9ba75xwmnqzpgbm23fa1hh8pi9c";
};
beamDeps = with final; [];
2022-09-09 09:30:32 +00:00
};
2022-09-25 13:06:44 +00:00
crypt = beamPackages.buildRebar3 rec {
name = "crypt";
version = "0.4.3";
src = fetchFromGitHub {
owner = "msantos";
repo = "crypt";
rev = "f75cd55325e33cbea198fb41fe41871392f8fb76";
sha256 = "sha256-ZYhZTe7cTITkl8DZ4z2IOlxTX5gnbJImu/lVJ2ZjR1o=";
};
postInstall = "mv $out/lib/erlang/lib/crypt-${version}/priv/{source,crypt}.so";
beamDeps = with final; [elixir_make];
2022-10-23 10:12:24 +00:00
buildInputs = [libxcrypt];
2022-09-25 13:06:44 +00:00
};
2022-09-14 19:04:58 +00:00
elasticsearch = beamPackages.buildMix rec {
name = "elasticsearch";
version = "1.0.1";
2022-09-25 13:06:44 +00:00
2022-09-14 19:04:58 +00:00
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "elasticsearch-elixir";
rev = "6cd946f75f6ab9042521a009d1d32d29a90113ca";
2022-09-25 13:06:44 +00:00
hash = "sha256-CtmQHVl+VTpemne+nxbkYGcErrgCo+t3ZBPbkFSpyF0=";
2022-09-14 19:04:58 +00:00
};
2022-09-25 13:06:44 +00:00
beamDeps = with final; [];
};
gettext = beamPackages.buildMix {
name = "gettext";
version = "0.19.1";
src = fetchFromGitHub {
owner = "tusooa";
repo = "gettext";
rev = "72fb2496b6c5280ed911bdc3756890e7f38a4808";
hash = "sha256-V0qmE+LcAbVoWsJmWE4fwrduYFIZ5BzK/sGzgLY3eH0=";
};
2022-09-14 19:04:58 +00:00
beamDeps = with final; [];
2022-09-09 09:30:32 +00:00
};
2022-09-14 19:04:58 +00:00
linkify = beamPackages.buildMix rec {
name = "linkify";
version = "0.5.2";
2022-09-25 13:06:44 +00:00
2022-09-14 19:04:58 +00:00
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "linkify";
rev = "2567e2c1073fa371fd26fd66dfa5bc77b6919c16";
2022-09-25 13:06:44 +00:00
hash = "sha256-e3wzlbRuyw/UB5Tb7IozX/WR1T+sIBf9C/o5Thki9vg=";
2022-09-14 19:04:58 +00:00
};
2022-09-25 13:06:44 +00:00
2022-09-14 19:04:58 +00:00
beamDeps = with final; [];
2022-09-09 09:30:32 +00:00
};
2022-09-14 19:04:58 +00:00
mfm_parser = beamPackages.buildMix rec {
name = "mfm_parser";
version = "0.1.1";
2022-09-25 13:06:44 +00:00
2022-09-14 19:04:58 +00:00
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "mfm-parser";
rev = "912fba81152d4d572e457fd5427f9875b2bc3dbe";
2022-09-25 13:06:44 +00:00
hash = "sha256-n3WmERxKK8VM8jFIBAPS6GkbT7/zjqi3AjjWbjOdMzs=";
2022-09-14 19:04:58 +00:00
};
2022-09-09 09:30:32 +00:00
2022-09-25 13:06:44 +00:00
beamDeps = with final; [phoenix_view temple];
2022-09-09 09:30:32 +00:00
};
2022-09-14 19:04:58 +00:00
remote_ip = beamPackages.buildMix rec {
name = "remote_ip";
version = "0.1.5";
2022-09-09 09:30:32 +00:00
2022-09-14 19:04:58 +00:00
src = fetchFromGitLab {
domain = "git.pleroma.social";
group = "pleroma";
owner = "elixir-libraries";
repo = "remote_ip";
rev = "b647d0deecaa3acb140854fe4bda5b7e1dc6d1c8";
sha256 = "0c7vmakcxlcs3j040018i7bfd6z0yq6fjfig02g5fgakx398s0x6";
};
beamDeps = with final; [combine plug inet_cidr];
2022-09-09 09:30:32 +00:00
};
2022-09-14 19:04:58 +00:00
search_parser = beamPackages.buildMix rec {
name = "search_parser";
version = "0.1.0";
2022-09-25 13:06:44 +00:00
2022-09-14 19:04:58 +00:00
src = fetchFromGitHub {
owner = "FloatingGhost";
repo = "pleroma-contrib-search-parser";
rev = "08971a81e68686f9ac465cfb6661d51c5e4e1e7f";
2022-09-25 13:06:44 +00:00
hash = "sha256-sbo9Kcp2oT05o2GAF+IgziLPYmCkWgBfFMBCytmqg3Y=";
2022-09-14 19:04:58 +00:00
};
2022-09-25 13:06:44 +00:00
2022-09-14 19:04:58 +00:00
beamDeps = with final; [nimble_parsec];
2022-09-09 09:30:32 +00:00
};
2022-09-25 13:06:44 +00:00
temple = beamPackages.buildMix rec {
name = "temple";
version = "0.9.0-rc.0";
2022-09-09 09:30:32 +00:00
2022-09-25 13:06:44 +00:00
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "temple";
rev = "066a699ade472d8fa42a9d730b29a61af9bc8b59";
hash = "sha256-qA0z8WTMjO2OixcZBARn/LbuV3s3LGtwZ9nSjj/tWBc=";
2022-09-14 19:04:58 +00:00
};
2022-09-09 09:30:32 +00:00
2022-09-25 13:06:44 +00:00
mixEnv = "dev";
beamDeps = with final; [earmark_parser ex_doc makeup makeup_elixir makeup_erlang nimble_parsec];
2022-09-14 19:04:58 +00:00
};
2022-09-09 09:30:32 +00:00
2022-09-14 19:04:58 +00:00
# Some additional build inputs and build fixes
2022-09-25 13:06:44 +00:00
fast_html = prev.fast_html.override {
nativeBuildInputs = [cmake];
dontUseCmakeConfigure = true;
};
2022-09-14 19:04:58 +00:00
http_signatures = prev.http_signatures.override {
patchPhase = ''
substituteInPlace mix.exs --replace ":logger" ":logger, :public_key"
'';
};
2022-09-25 13:06:44 +00:00
majic = prev.majic.override {
buildInputs = [file];
2022-09-14 19:04:58 +00:00
};
syslog = prev.syslog.override {
buildPlugins = with beamPackages; [pc];
};
2022-09-09 09:30:32 +00:00
2022-09-14 19:04:58 +00:00
mime = prev.mime.override {
patchPhase = let
cfgFile = writeText "config.exs" ''
use Mix.Config
config :mime, :types, %{
"application/activity+json" => ["activity+json"],
"application/jrd+json" => ["jrd+json"],
"application/ld+json" => ["activity+json"],
"application/xml" => ["xml"],
"application/xrd+xml" => ["xrd+xml"]
}
'';
in ''
mkdir config
cp ${cfgFile} config/config.exs
2022-09-09 09:30:32 +00:00
'';
2022-09-14 19:04:58 +00:00
};
2022-09-09 09:30:32 +00:00
};
2022-09-09 10:36:29 +00:00
};
2022-09-25 13:06:44 +00:00
passthru = {
inherit mixNixDeps;
updateScript = writeScript "update-akkoma" ''
${../scripts/update-git.sh} https://akkoma.dev/AkkomaGang/akkoma.git akkoma/source.json
SRC_PATH=$(nix-build -E '(import ./. {}).${pname}.src')
${../scripts/update-mix.sh} $SRC_PATH akkoma/mix.nix
'';
2022-09-11 18:20:50 +00:00
};
2022-09-25 13:06:44 +00:00
meta = with lib; {
description = "ActivityPub microblogging server";
homepage = "https://akkoma.dev";
license = licenses.agpl3;
platforms = platforms.unix;
};
}