net-vpn/headscale - 0.29.7 (ryans)

Search

Install

Install this version:

emerge -a =net-vpn/headscale-0.29.7

If this version is masked, you can unmask it using the autounmask tool or standard emerge options:

autounmask =net-vpn/headscale-0.29.7

Or alternatively:

emerge --autounmask-write -a =net-vpn/headscale-0.29.7

Package Information

Description:
An open source, self-hosted implementation of the Tailscale control server
Homepage:
https://github.com/juanfont/headscale
License:
Apache-2.0 BSD-2 BSD ISC MIT MPL-2.0

Ebuild Details

Version EAPI Keywords Slot
0.29.7 8 ~amd64 ~arm64 ~riscv 0
View Raw Ebuild
# Copyright 2023-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit go systemd tmpfiles

DESCRIPTION="An open source, self-hosted implementation of the Tailscale control server"
HOMEPAGE="https://github.com/juanfont/headscale"
SRC_URI="https://github.com/juanfont/headscale/archive/refs/tags/v${PV//_/-}.tar.gz -> ${P}.tar.gz"

# https://github.com/bekcpear/vendor-for-go -> exec: .do/do.sh /path/to/repo headscale ${PV}
SRC_URI+=" https://github.com/bekcpear/gopkg-vendors/archive/refs/tags/vendor-${P//_/-}.tar.gz -> ${P}-vendor.tar.gz"

S="${WORKDIR}/${PN}-${PV//_/-}"

LICENSE="Apache-2.0 BSD-2 BSD ISC MIT MPL-2.0"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~riscv"

BDEPEND=">=dev-lang/go-1.26.8:="
RDEPEND="
	acct-group/headscale
	acct-user/headscale
"

# headscale reports its version from runtime/debug build info, which has no
# VCS metadata to read in a distfile build, and upstream offers no variable to
# inject one (its own Makefile passes '-X main.version=', a symbol that does not
# exist). The patch below adds two, so both the version and the real upstream
# commit can be stamped. UPDATE THE COMMIT ON EVERY BUMP, it is the object the
# v${PV} tag points at:
#   curl -s https://api.github.com/repos/juanfont/headscale/git/refs/tags/v${PV}
PATCHES=( "${FILESDIR}"/${P}-version-stamp.patch )

HEADSCALE_GIT_COMMIT="0f7d1e53"

GO_LDFLAGS="
	-X 'github.com/juanfont/headscale/hscontrol/types.stampVersion=v${PV//_/-}'
	-X 'github.com/juanfont/headscale/hscontrol/types.stampCommit=${HEADSCALE_GIT_COMMIT}'"
GO_TARGET_PKGS="./cmd/headscale"

src_prepare() {
	rm -rf ./gen || die
	mv ../gopkg-vendors-vendor-${P//_/-}/gen ./ || die
	default
}

src_install() {
	go_src_install

	# /var/lib/headscale is the home of acct-user/headscale, which creates it
	keepdir /etc/headscale

	dodoc config-example.yaml derp-example.yaml

	newtmpfiles "${FILESDIR}"/headscale.tmpfiles headscale.conf

	systemd_dounit "${FILESDIR}"/headscale.service
	systemd_install_serviced "${FILESDIR}"/headscale.service.conf headscale

	newconfd "${FILESDIR}"/headscale.confd headscale
	newinitd "${FILESDIR}"/headscale.initd headscale
}

pkg_postinst() {
	tmpfiles_process headscale.conf
	if [[ -z ${REPLACING_VERSIONS} ]] ; then
		elog "headscale need a config file to run server, the default path: /etc/headscale/config.yaml"
		elog "Here is an example config file: ${EROOT}/usr/share/doc/${P}/config-example.yaml*"

		if ! systemd_is_booted; then
			elog "You can also set HEADSCALE_EXTRA_ARGS to '-c /path/to/config/file' in the"
			elog "  ${EROOT}/etc/conf.d/headscale file to specify a different path."
		else
			elog "You can also set 'ExecStart=' in the"
			elog "  ${EROOT}/etc/systemd/system/headscale.d/00gentoo.conf file"
			elog "  to specify customized command."
		fi

		elog
		elog "You have to add your user to the 'headscale' group to handle the headscale server,"
		if ! systemd_is_booted; then
			elog "  or set your customized user, group in the ${EROOT}/etc/conf.d/headscale file,"
		else
			elog "  or set your customized user, group in the"
			elog "  ${EROOT}/etc/systemd/system/headscale.d/00gentoo.conf file,"
		fi
		elog "  or run as root,"
		elog "  or use gRPC."
	else
		ewarn "**BACKUP** your database before restarting!"

		local major= minor=
		IFS="." read -r major minor _ <<<"$REPLACING_VERSIONS"
		if (( $major == 0 && $minor < 25 )); then
			ewarn ">=headscale-0.28.0 has dropped the database migration support for the"
			ewarn "databases created before 0.25.0, so upgrading directly from"
			ewarn "${REPLACING_VERSIONS} is NOT supported."
			ewarn "Upgrade sequentially through each stable release, taking the latest"
			ewarn "patch version of every minor release, and start with 0.25.1."
			ewarn "See the recommended update path:"
			ewarn "  https://headscale.net/stable/about/faq/#what-is-the-recommended-update-path-can-i-skip-multiple-versions-while-updating"
		fi
	fi
}

Inherited Eclasses

go

Dependencies

RDEPEND

	acct-group/headscale
	acct-user/headscale

BDEPEND

>=dev-lang/go-1.26.8:=

Manifest for 0.29.7

Type File Size Source URLs
DIST headscale-0.29.7-vendor.tar.gz 60131623 bytes https://github.com/bekcpear/gopkg-vendors/archive/refs/tags/vendor-headscale-0.29.7.tar.gz
DIST headscale-0.29.7.tar.gz 44221151 bytes https://github.com/juanfont/headscale/archive/refs/tags/v0.29.7.tar.gz