summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 28fab1eeac92eaf2e9626248d5bc9b070f204344 (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
# Maintainer: Tyler Cook <aur@fossable.org>
pkgdesc='Immutable infrastructure for the desktop!'
pkgname='goldboot-registry'
pkgver='0.0.2'
pkgrel='1'
url='https://github.com/fossable/goldboot'
arch=('x86_64')
license=('GNU Affero General Public License v3.0')
depends=('edk2-ovmf' 'qemu-base')
makedepends=('cargo')
source=("goldboot-$pkgver.tar.gz::https://static.crates.io/crates/goldboot/goldboot-$pkgver.crate")
sha512sums=('SKIP')

prepare() {
	export RUSTUP_TOOLCHAIN=stable
	cargo fetch --bin goldboot --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
	export RUSTUP_TOOLCHAIN=stable
	export CARGO_TARGET_DIR=target
	cargo build --bin goldboot --frozen --release --no-default-features --features cast --features registry
}

check() {
	export RUSTUP_TOOLCHAIN=stable
	cargo test --bin goldboot --frozen --no-default-features --features cast --features registry
}

package() {
	install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/$pkgname"

	# Install systemd unit
	cat <<-EOF >"${pkgdir}/usr/lib/systemd/system/goldboot-registry.service"
		[Unit]
		Description=Goldboot registry
		After=network.target
		StartLimitIntervalSec=0

		[Service]
		Type=simple
		Restart=always
		RestartSec=1
		User=sandpolis
		ExecStart=/usr/bin/goldboot

		[Install]
		WantedBy=multi-user.target
	EOF
}