summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7f65aa6c5b61fa8adbc09a227b28c46b7aa8e0ec (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
# Maintainer: Petr Kracik <petrkr@petrkr.net>
pkgname=nostr-rs-relay
pkgver=0.8.13
pkgrel=1
makedepends=('rust' 'cargo' 'protobuf')
arch=('i686' 'x86_64' 'armv6h' 'armv7h')
pkgdesc="A relay implementation for the Nostr protocol"
url="https://sr.ht/~gheartsfield/nostr-rs-relay/"
license=('MIT')
source=("https://git.sr.ht/~gheartsfield/$pkgname/archive/$pkgver.tar.gz")
backup=("etc/nostr-rs-relay/config.toml")

sha256sums=('3fb1bffb88edfbb0faef255e919ea3cd346e32e74b7d22078a9ed9d51ed770ec')

prepare() {
  cd $pkgname-$pkgver
  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
  cd $pkgname-$pkgver
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  cargo build --frozen --release --all-features

  # Tweek systemd service
  sed "s|User.*|User=nostr-rs-relay|" contrib/nostr-rs-relay.service > target/release/nostr-rs-relay.service
  sed "s|WorkingDirectory.*|WorkingDirectory=/var/lib/nostr-rs-relay|" -i target/release/nostr-rs-relay.service
}

check() {
  cd $pkgname-$pkgver
  export RUSTUP_TOOLCHAIN=stable
  cargo test --frozen --all-features
}

package() {
 install=nostr-rs-relay.install
 
# Create database directory
  install -dm0755 "$pkgdir/var/lib/nostr-rs-relay"
  install -Dm0755 -t "$pkgdir/usr/bin/" "$pkgname-$pkgver/target/release/$pkgname"
  install -Dm0644 -t "$pkgdir/etc/nostr-rs-relay/" "$pkgname-$pkgver/config.toml"
  install -Dm0644 -t "$pkgdir/usr/lib/systemd/system/" "$pkgname-$pkgver/target/release/nostr-rs-relay.service"
  }