summaryrefslogtreecommitdiff
path: root/www-apps/akkoma/akkoma-3.12.2.ebuild
blob: 2a1a0f6d750d22af8283ae4b33557e544105bee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Copyright 2022-2023 Anna (navi) Figueiredo Gomes
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit mix optfeature

DESCRIPTION="a smallish microblogging platform"
HOMEPAGE="https://akkoma.social/"

SRC_URI="https://akkoma.dev/AkkomaGang/akkoma/archive/v${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}"
KEYWORDS="~amd64"

LICENSE="AGPL-3 CC-BY-SA-4.0 CC-BY-4.0"
SLOT="otp"

# Requires network access (https) as long as elixir dependencies aren't packaged
# said dependencies have their checksum verified via `mix.lock`
RESTRICT="network-sandbox"

BDEPEND="
	>=dev-lang/erlang-25:=
	>=dev-lang/elixir-1.14:=
	dev-build/cmake
	>=dev-util/rebar-3.20.0-r1
	dev-elixir/hex
"
DEPEND="
	sys-libs/ncurses:=
	sys-apps/file
"
RDEPEND="
	${DEPEND}
	acct-user/akkoma
	acct-group/akkoma
	dev-db/postgresql[uuid]
"

src_unpack() {
	default

	cd "${S}" || die
	emix deps.get --only prod
}

src_prepare() {
	default

	sed -i -e '/include_executables_for:/a\          strip_beams: false,\n\          include_erts: false,' mix.exs || die

	sed -i \
		-e '/update \[OPTIONS\]/,/--tmp-dir/d' \
		-e 's;update "$@";echo "Unsupported, check the '"${CATEGORY}/${PN}"' package instead.";' \
		rel/files/bin/pleroma_ctl || die

	# Default ends up being inside /opt/akkoma which should be kept read-only to akkoma
	echo 'config :tzdata, :data_dir, "/var/lib/akkoma/tzdata"' >> config/prod.exs || die

	echo "import Config" > config/prod.secret.exs || die
}

src_compile() {
	mkdir -p akkoma || die
	emix release --overwrite --path akkoma
}

src_install() {
	# doins doesn't seems to preserve permissions
	mkdir -p "${ED}/opt" || die
	cp -pr ./akkoma "${ED}/opt/akkoma" || die
	fperms 0750 /opt/akkoma
	fowners 0:akkoma /opt/akkoma

	doinitd ./akkoma/installation/init.d/akkoma

	dosym /opt/akkoma/bin/pleroma /usr/bin/pleroma
	dosym /opt/akkoma/bin/pleroma_ctl /usr/bin/pleroma_ctl

	# This file controls console access
	fperms 0750 /opt/akkoma/releases/COOKIE
	fowners 0:akkoma /opt/akkoma/releases/COOKIE

	keepdir /etc/akkoma
	fperms 0750 /etc/akkoma
	fowners 0:akkoma /etc/akkoma

	keepdir /var/lib/akkoma
	fperms 0750 /var/lib/akkoma
	fowners akkoma:akkoma /var/lib/akkoma
}

pkg_postinst() {
	optfeature "For Pleroma.Upload.Filters.{Mogrify,Mogrifun} & images in previews" media-gfx/imagemagick
	optfeature "For video support in Media Preview Proxy" media-video/ffmpeg
	optfeature "For Pleroma.Upload.Filters.Exiftool.* filters" media-libs/exiftool
}