Install this version:
emerge -a =app-metrics/alloy-1.22.0
If this version is masked, you can unmask it using the autounmask tool or standard emerge options:
autounmask =app-metrics/alloy-1.22.0
Or alternatively:
emerge --autounmask-write -a =app-metrics/alloy-1.22.0
| Version | EAPI | Keywords | Slot |
|---|---|---|---|
| 1.22.0 | 8 | ~amd64 | 0 |
# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
NODEJS_MOD_PREFIX="internal/web/ui"
inherit go-env go-module nodejs-mod shell-completion systemd tmpfiles
DESCRIPTION="OpenTelemetry Collector distribution with programmable pipelines"
HOMEPAGE="https://grafana.com/oss/alloy/ https://github.com/grafana/alloy"
SRC_URI="https://github.com/grafana/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
https://www.inode64.com/dist/${P}-vendor.tar.xz
https://www.inode64.com/dist/${P}-node_modules.tar.xz
"
LICENSE="Apache-2.0"
# Dependent licenses. The logql packages of Loki are AGPL-3.
LICENSE+=" 0BSD AGPL-3 BSD BSD-2 ISC MIT MIT-0 MPL-2.0"
# Icons and fonts of the embedded web UI
LICENSE+=" CC-BY-4.0 OFL-1.1"
SLOT="0"
# The node_modules tarball carries the esbuild and rollup binaries for amd64.
KEYWORDS="~amd64"
IUSE="systemd"
# go-systemd builds against the headers of libsystemd and opens it with
# dlopen() to read the journal.
DEPEND="
app-arch/zstd:=
systemd? ( sys-apps/systemd )
"
RDEPEND="${DEPEND}
acct-user/alloy
app-misc/ca-certificates
!app-metrics/alloy-bin
"
BDEPEND="
>=dev-lang/go-1.27.3
>=net-libs/nodejs-24.16
"
src_unpack() {
# go-module verifies the root module against the network when there is
# no vendor/ beside it, but the module that builds the binary, and the
# one vendored, is collector/.
default
go-env_set_compile_environment
}
src_prepare() {
# collector/go.mod replaces github.com/grafana/alloy with ../, so go mod
# vendor copies those packages into collector/vendor, and the build
# compiles that copy instead of ${S}. Changes to Alloy itself go there.
local vendored=collector/vendor/github.com/grafana/${PN}
# Trust only the system CA store, as Nixpkgs does: the fallback bundle is
# frozen at the vendored x/crypto and would take over unnoticed if the
# store went missing.
sed -i -e '\|"golang.org/x/crypto/x509roots/fallback"|d' ${vendored}/flowcmd/flowcmd.go || die
if grep -rq --include='*.go' 'x509roots/fallback"' ${vendored}; then
die "The fallback CA bundle is still imported"
fi
nodejs-mod_src_prepare
}
src_configure() {
# The tags of the upstream release, plus the system libzstd instead of
# the copy that DataDog/zstd bundles, as Alpine does.
ALLOY_TAGS="embedalloyui,gore2regex,netgo,external_libzstd"
use systemd && ALLOY_TAGS+=",promtail_journal_enabled"
local vprefix="github.com/grafana/${PN}/internal/build"
local ldflags=(
-X ${vprefix}.Version=v${PV}
-X github.com/grafana/${PN}/syntax/internal/stdlib.Version=v${PV}
-X ${vprefix}.Branch=v${PV}
-X ${vprefix}.Revision=v${PV}
-X ${vprefix}.BuildUser=portage@gentoo
-X ${vprefix}.BuildDate=$(date -u -d "@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y-%m-%dT%H:%M:%SZ)
)
ALLOY_LDFLAGS="${ldflags[*]}"
}
src_compile() {
# Builds internal/web/ui/dist, which embedalloyui embeds in the binary
# from the vendored copy of Alloy (see src_prepare).
nodejs-mod_src_compile
cp -r ${NODEJS_MOD_PREFIX}/dist collector/vendor/github.com/grafana/${PN}/${NODEJS_MOD_PREFIX}/ || die
pushd collector >/dev/null || die
ego build -trimpath -tags "${ALLOY_TAGS}" -ldflags "${ALLOY_LDFLAGS}" -o "${S}"/alloy .
popd >/dev/null || die
local shell
for shell in bash fish zsh; do
./alloy completion ${shell} > alloy.${shell} || die
done
}
src_test() {
# The upstream suite needs Docker and the network. Test how the collector
# derives its version, and that the binary loads the configuration it
# installs, with every component registered.
pushd collector >/dev/null || die
ego test -trimpath -tags "${ALLOY_TAGS}" .
popd >/dev/null || die
./alloy validate packaging/config.alloy || die
./alloy --version | grep -F "v${PV}" || die
}
src_install() {
dobin alloy
einstalldocs
newbashcomp alloy.bash alloy
newfishcomp alloy.fish alloy.fish
newzshcomp alloy.zsh _alloy
insinto /etc/alloy
doins packaging/config.alloy
newinitd "${FILESDIR}"/${PN}.initd ${PN}
newconfd "${FILESDIR}"/${PN}.confd ${PN}
systemd_dounit "${FILESDIR}"/${PN}.service
newtmpfiles "${FILESDIR}"/${PN}.tmpfiles.conf ${PN}.conf
}
pkg_postinst() {
tmpfiles_process ${PN}.conf
if [[ -z ${REPLACING_VERSIONS} ]]; then
elog "beyla.ebpf does not work in this build: upstream embeds a prebuilt"
elog "Beyla binary. ${CATEGORY}/${PN}-bin includes it, if it is needed."
fi
}
Manage flags for this package:
euse -i <flag> -p app-metrics/alloy |
euse -E <flag> -p app-metrics/alloy |
euse -D <flag> -p app-metrics/alloy
app-arch/zstd:= systemd? ( sys-apps/systemd )
app-arch/zstd:= systemd? ( sys-apps/systemd ) acct-user/alloy app-misc/ca-certificates !app-metrics/alloy-bin
>=dev-lang/go-1.27.3 >=net-libs/nodejs-24.16
| Type | File | Size | Source URLs |
|---|---|---|---|
| DIST | alloy-1.22.0-node_modules.tar.xz | 18522012 bytes | https://www.inode64.com/dist/alloy-1.22.0-node_modules.tar.xz |
| DIST | alloy-1.22.0-vendor.tar.xz | 47700168 bytes | https://www.inode64.com/dist/alloy-1.22.0-vendor.tar.xz |
| DIST | alloy-1.22.0.tar.gz | 18861429 bytes | https://github.com/grafana/alloy/archive/v1.22.0.tar.gz |