summaryrefslogtreecommitdiff
blob: f51d35a6474b5aff119ea32a33de08ce0e6dab70 (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
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7
inherit go-module systemd
GIT_COMMIT=00263bf92ee3fe7964fbc08b150600a43df0abb8

DESCRIPTION="A simple and flexible workload orchestrator "
HOMEPAGE="https://nomadproject.io"
SRC_URI="https://github.com/hashicorp/nomad/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="MPL-2.0"
SLOT="0"
KEYWORDS="~amd64"
IUSE=""

src_compile() {
	local go_ldflags go_tags
	go_ldflags="-X github.com/hashicorp/nomad/version.GitCommit=${GIT_COMMIT}"
	go_tags="codegen_generated"
	CGO_ENABLED=1 \
		go build \
		-trimpath \
		-ldflags "${go_ldflags}" \
		-mod=vendor \
		-tags "${go_tags}" \
		-o bin/${PN} || die "compile failed"
}

src_install() {
	dobin bin/${PN}
	systemd_dounit dist/systemd/nomad.service
	insinto /etc/nomad.d
	newins dist/client.hcl client.hcl.example
	newins dist/server.hcl server.hcl.example
	keepdir /var/lib/nomad /var/log/nomad
	newconfd "${FILESDIR}/nomad.confd" nomad
	newinitd "${FILESDIR}/nomad.initd" nomad
	insinto /etc/logrotate.d
	newins "${FILESDIR}/nomad.logrotated" nomad
}