Merge pull request #300343 from tcmal/akkoma-update-main

akkoma: 3.11.0 -> 3.12.1
This commit is contained in:
Thomas Gerbet 2024-04-12 23:13:10 +02:00 committed by GitHub
commit 8aa99de316
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 1354 additions and 1301 deletions

View File

@ -19614,6 +19614,12 @@
githubId = 2389333;
name = "Andy Tockman";
};
tcmal = {
email = "me@aria.rip";
github = "tcmal";
githubId = 4183876;
name = "Aria Shrimpton";
};
teatwig = {
email = "nix@teatwig.net";
name = "tea";

View File

@ -414,6 +414,10 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m
- The `erlang_node_short_name`, `erlang_node_name`, `port` and `options` configuration parameters are gone, and have been replaced with an `environment` parameter.
Use the appropriate [environment variables](https://hexdocs.pm/livebook/readme.html#environment-variables) inside `environment` to configure the service instead.
- `akkoma` now requires explicitly setting the base URL for uploaded media (`settings."Pleroma.Upload".base_url`), as well as for the media proxy if enabled (`settings."Media"`).
This is recommended to be a separate (sub)domain to the one Akkoma is hosted at.
See [here](https://meta.akkoma.dev/t/akkoma-stable-2024-03-securer-i-barely-know-her/681#explicit-upload-and-media-proxy-domains-5) for more details.
- The `crystal` package has been updated to 1.11.x, which has some breaking changes.
Refer to crystal's changelog for more information. ([v1.10](https://github.com/crystal-lang/crystal/blob/master/CHANGELOG.md#1100-2023-10-09), [v1.11](https://github.com/crystal-lang/crystal/blob/master/CHANGELOG.md#1110-2024-01-08))

View File

@ -764,6 +764,21 @@ in {
};
};
"Pleroma.Upload" = let
httpConf = cfg.config.":pleroma"."Pleroma.Web.Endpoint".url;
in {
base_url = mkOption {
type = types.nonEmptyStr;
default = if lib.versionOlder config.system.stateVersion "24.05"
then "${httpConf.scheme}://${httpConf.host}:${builtins.toString httpConf.port}/media/"
else null;
description = mdDoc ''
Base path which uploads will be stored at.
Whilst this can just be set to a subdirectory of the main domain, it is now recommended to use a different subdomain.
'';
};
};
":frontends" = mkOption {
type = elixirValue;
default = mapAttrs
@ -781,6 +796,30 @@ in {
[{option}`config.services.akkoma.frontends`](#opt-services.akkoma.frontends).
'';
};
":media_proxy" = let
httpConf = cfg.config.":pleroma"."Pleroma.Web.Endpoint".url;
in {
enabled = mkOption {
type = types.bool;
default = false;
description = mdDoc ''
Whether to enable proxying of remote media through the instance's proxy.
'';
};
base_url = mkOption {
type = types.nullOr types.nonEmptyStr;
default = if lib.versionOlder config.system.stateVersion "24.05"
then "${httpConf.scheme}://${httpConf.host}:${builtins.toString httpConf.port}/media/"
else null;
description = mdDoc ''
Base path for the media proxy.
Whilst this can just be set to a subdirectory of the main domain, it is now recommended to use a different subdomain.
'';
};
};
};
":web_push_encryption" = mkOption {
@ -904,6 +943,9 @@ in {
};
config = mkIf cfg.enable {
assertions = optionals (cfg.config.":pleroma".":media_proxy".enabled && cfg.config.":pleroma".":media_proxy".base_url == null) [''
`services.akkoma.config.":pleroma".":media_proxy".base_url` must be set when the media proxy is enabled.
''];
warnings = optionals (with config.security; (!sudo.enable) && (!sudo-rs.enable)) [''
The pleroma_ctl wrapper enabled by the installWrapper option relies on
sudo, which appears to have been disabled through security.sudo.enable.
@ -1083,6 +1125,6 @@ in {
};
};
meta.maintainers = with maintainers; [ mvs ];
meta.maintainers = with maintainers; [ mvs tcmal ];
meta.doc = ./akkoma.md;
}

View File

@ -36,7 +36,8 @@ let
${pkgs.toot}/bin/toot timeline -1 | grep -F -q "hello world Jamy here"
# Test file upload
${pkgs.toot}/bin/toot upload <(dd if=/dev/zero bs=1024 count=1024 status=none)
echo "y" | ${pkgs.toot}/bin/toot upload <(dd if=/dev/zero bs=1024 count=1024 status=none) \
| grep -F -q "https://akkoma.nixos.test:443/media"
'';
checkFe = pkgs.writers.writeBashBin "checkFe" ''
@ -90,6 +91,9 @@ in
"Pleroma.Web.Endpoint" = {
url.host = "akkoma.nixos.test";
};
"Pleroma.Upload" = {
base_url = "https://akkoma.nixos.test:443/media/";
};
};
};

View File

@ -1,22 +1,24 @@
{ lib
, beamPackages
, fetchFromGitea, fetchFromGitHub, fetchFromGitLab
, cmake, file
, fetchFromGitea
, fetchFromGitHub
, fetchFromGitLab
, cmake
, file
, writeText
, nixosTests
, ...
}:
beamPackages.mixRelease rec {
pname = "pleroma";
version = "3.11.0";
pname = "akkoma";
version = "3.12.2";
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "akkoma";
rev = "v${version}";
hash = "sha256-cVZx3pjbmDR4SwSLz1aSTIs3SS2oz5m43RJzRttFpPs=";
hash = "sha256-eKvfuHTLmUU6Dom/GctPSbhrAAik1T/7bYY5j3YUkRo=";
};
postPatch = ''
@ -33,187 +35,178 @@ beamPackages.mixRelease rec {
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";
src = fetchFromGitLab {
domain = "git.pleroma.social";
group = "pleroma";
owner = "elixir-libraries";
repo = "elixir-captcha";
rev = "90f6ce7672f70f56708792a98d98bd05176c9176";
hash = "sha256-s7EuAhmCsQA/4p2NJHJSWB/DZ5hA+7EelPsUOvKr2Po=";
};
# the binary is not getting installed by default
postInstall = "mv priv/* $out/lib/erlang/lib/${name}-${version}/priv/";
};
concurrent_limiter = beamPackages.buildMix rec {
name = "concurrent_limiter";
version = "0.1.1";
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "concurrent-limiter";
rev = "a9e0b3d64574bdba761f429bb4fba0cf687b3338";
hash = "sha256-A7ucZnXks4K+JDVY5vV2cT5KfEOUOo/OHO4rga5mGys=";
};
};
elasticsearch = beamPackages.buildMix rec {
name = "elasticsearch";
version = "1.0.1";
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "elasticsearch-elixir";
rev = "6cd946f75f6ab9042521a009d1d32d29a90113ca";
hash = "sha256-CtmQHVl+VTpemne+nxbkYGcErrgCo+t3ZBPbkFSpyF0=";
};
};
file_ex = beamPackages.buildMix rec {
name = "file_ex";
version = "0.1.0";
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "file_ex";
rev = "cc7067c7d446c2526e9ecf91d40896b088851569";
hash = "sha256-3sxfdOy0cpst4jiutoaabk72VFJ2USKiJN9ODN01Dco=";
};
};
http_signatures = beamPackages.buildMix rec {
name = "http_signatures";
version = "0.1.1";
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "http_signatures";
rev = "6640ce7d24c783ac2ef56e27d00d12e8dc85f396";
hash = "sha256-Q/IoVbM/TBgGCmx8AxiBHF2hARb0FbPml8N1HjN3CsE=";
};
};
linkify = beamPackages.buildMix rec {
name = "linkify";
version = "0.5.2";
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "linkify";
rev = "2567e2c1073fa371fd26fd66dfa5bc77b6919c16";
hash = "sha256-e3wzlbRuyw/UB5Tb7IozX/WR1T+sIBf9C/o5Thki9vg=";
};
};
majic = beamPackages.buildMix rec {
name = "majic";
version = "1.0.0";
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "majic";
rev = "80540b36939ec83f48e76c61e5000e0fd67706f0";
hash = "sha256-OMM9aDRvbqCOBIE+iPySU8ONRn1BqHDql22rRSmdW08=";
};
beamDeps = with final; [ elixir_make mime nimble_pool plug ];
buildInputs = [ file ];
};
mfm_parser = beamPackages.buildMix rec {
name = "mfm_parser";
version = "0.1.0";
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "mfm-parser";
rev = "b21ab7754024af096f2d14247574f55f0063295b";
hash = "sha256-couG5jrAo0Fbk/WABd4n3vhXpDUp+9drxExKc5NM9CI=";
};
beamDeps = with final; [ phoenix_view temple ];
};
search_parser = beamPackages.buildMix rec {
name = "search_parser";
version = "0.1.0";
src = fetchFromGitHub {
owner = "FloatingGhost";
repo = "pleroma-contrib-search-parser";
rev = "08971a81e68686f9ac465cfb6661d51c5e4e1e7f";
hash = "sha256-sbo9Kcp2oT05o2GAF+IgziLPYmCkWgBfFMBCytmqg3Y=";
};
beamDeps = with final; [ nimble_parsec ];
};
temple = beamPackages.buildMix rec {
name = "temple";
version = "0.9.0-rc.0";
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "temple";
rev = "066a699ade472d8fa42a9d730b29a61af9bc8b59";
hash = "sha256-qA0z8WTMjO2OixcZBARn/LbuV3s3LGtwZ9nSjj/tWBc=";
};
mixEnv = "dev";
beamDeps = with final; [ earmark_parser ex_doc makeup makeup_elixir makeup_erlang nimble_parsec ];
};
# Some additional build inputs and build fixes
fast_html = prev.fast_html.override {
nativeBuildInputs = [ cmake ];
dontUseCmakeConfigure = true;
};
syslog = prev.syslog.override {
buildPlugins = with beamPackages; [ pc ];
};
mime = prev.mime.override {
patchPhase = let
cfgFile = writeText "config.exs" ''
import Config
config :mime, :types, %{
"application/xml" => ["xml"],
"application/xrd+xml" => ["xrd+xml"],
"application/jrd+json" => ["jrd+json"],
"application/activity+json" => ["activity+json"],
"application/ld+json" => ["activity+json"]
}
config :mime, :extensions, %{
"activity+json" => "application/activity+json"
}
'';
in ''
mkdir config
cp ${cfgFile} config/config.exs
overrides = final: prev:
let
mimeTypePatchPhase = ''
mkdir -p config
cat >> config/config.exs <<EOF
Mix.Config.config :mime, :types, %{
"application/xml" => ["xml"],
"application/xrd+xml" => ["xrd+xml"],
"application/jrd+json" => ["jrd+json"],
"application/activity+json" => ["activity+json"],
"application/ld+json" => ["activity+json"],
"image/apng" => ["apng"]
}
Mix.Config.config :mime, :extensions, %{
"activity+json" => "text/plain",
"jrd+json" => "text/plain",
"xrd+xml" => "text/plain"
}
EOF
'';
# Akkoma adds some things to the `mime` package's configuration, which requires it to be recompiled.
# However, we can't just recompile things like we would on other systems.
# Therefore, we need to add it to mime's compile-time config too, and also in every package that depends on mime, directly or indirectly.
# We take the lazy way out and just add it to every dependency - it won't make a difference in packages that don't depend on `mime`.
addMimeTypes = _: p: p.override {
patchPhase = mimeTypePatchPhase;
};
in
(lib.attrsets.mapAttrs addMimeTypes 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";
src = fetchFromGitLab {
domain = "git.pleroma.social";
group = "pleroma";
owner = "elixir-libraries";
repo = "elixir-captcha";
rev = "90f6ce7672f70f56708792a98d98bd05176c9176";
hash = "sha256-s7EuAhmCsQA/4p2NJHJSWB/DZ5hA+7EelPsUOvKr2Po=";
};
# the binary is not getting installed by default
postInstall = "mv priv/* $out/lib/erlang/lib/${name}-${version}/priv/";
};
concurrent_limiter = beamPackages.buildMix rec {
name = "concurrent_limiter";
version = "0.1.1";
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "concurrent-limiter";
rev = "a9e0b3d64574bdba761f429bb4fba0cf687b3338";
hash = "sha256-A7ucZnXks4K+JDVY5vV2cT5KfEOUOo/OHO4rga5mGys=";
};
};
elasticsearch = beamPackages.buildMix rec {
name = "elasticsearch";
version = "1.0.1";
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "elasticsearch-elixir";
rev = "6cd946f75f6ab9042521a009d1d32d29a90113ca";
hash = "sha256-CtmQHVl+VTpemne+nxbkYGcErrgCo+t3ZBPbkFSpyF0=";
};
};
linkify = beamPackages.buildMix rec {
name = "linkify";
version = "0.5.2";
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "linkify";
rev = "2567e2c1073fa371fd26fd66dfa5bc77b6919c16";
hash = "sha256-e3wzlbRuyw/UB5Tb7IozX/WR1T+sIBf9C/o5Thki9vg=";
};
};
mfm_parser = beamPackages.buildMix rec {
name = "mfm_parser";
version = "0.1.1";
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "mfm-parser";
rev = "b21ab7754024af096f2d14247574f55f0063295b";
hash = "sha256-couG5jrAo0Fbk/WABd4n3vhXpDUp+9drxExKc5NM9CI=";
};
beamDeps = with final; [ phoenix_view temple ];
patchPhase = mimeTypePatchPhase;
};
search_parser = beamPackages.buildMix rec {
name = "search_parser";
version = "0.1.0";
src = fetchFromGitHub {
owner = "FloatingGhost";
repo = "pleroma-contrib-search-parser";
rev = "08971a81e68686f9ac465cfb6661d51c5e4e1e7f";
hash = "sha256-sbo9Kcp2oT05o2GAF+IgziLPYmCkWgBfFMBCytmqg3Y=";
};
beamDeps = with final; [ nimble_parsec ];
};
temple = beamPackages.buildMix rec {
name = "temple";
version = "0.9.0-rc.0";
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "temple";
rev = "066a699ade472d8fa42a9d730b29a61af9bc8b59";
hash = "sha256-qA0z8WTMjO2OixcZBARn/LbuV3s3LGtwZ9nSjj/tWBc=";
};
mixEnv = "dev";
beamDeps = with final; [ earmark_parser ex_doc makeup makeup_elixir makeup_erlang nimble_parsec ];
patchPhase = mimeTypePatchPhase;
};
# Some additional build inputs and build fixes
fast_html = prev.fast_html.override {
nativeBuildInputs = [ cmake ];
dontUseCmakeConfigure = true;
};
http_signatures = beamPackages.buildMix rec {
name = "http_signatures";
version = "0.1.2";
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "http_signatures";
rev = "6640ce7d24c783ac2ef56e27d00d12e8dc85f396";
hash = "sha256-Q/IoVbM/TBgGCmx8AxiBHF2hARb0FbPml8N1HjN3CsE=";
};
beamDeps = with final; [ credo ex_doc dialyxir temple ];
patchPhase = ''
substituteInPlace mix.exs --replace ":logger" ":logger, :public_key"
${mimeTypePatchPhase}
'';
};
majic = beamPackages.buildMix {
name = "majic";
version = "0.1.2";
src = fetchFromGitea {
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "majic";
rev = "80540b36939ec83f48e76c61e5000e0fd67706f0";
hash = "sha256-OMM9aDRvbqCOBIE+iPySU8ONRn1BqHDql22rRSmdW08=";
};
buildInputs = [ file ];
beamDeps = with final; [ nimble_pool mime plug credo dialyxir ex_doc elixir_make ];
patchPhase = mimeTypePatchPhase;
};
syslog = prev.syslog.override {
buildPlugins = with beamPackages; [ pc ];
};
};
});
};
passthru = {
@ -229,7 +222,7 @@ beamPackages.mixRelease rec {
description = "ActivityPub microblogging server";
homepage = "https://akkoma.social";
license = licenses.agpl3Only;
maintainers = with maintainers; [ mvs ];
maintainers = with maintainers; [ mvs tcmal ];
platforms = platforms.unix;
};
}

File diff suppressed because it is too large Load Diff