summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 24d0a923ae2e2f84af92848b24975649edb081eb (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: skwerlman <skw@tetrarch.co>

_pkgname=nil
pkgname=${_pkgname}-git
pkgver=2023.08.09.r26.g059d33a
pkgrel=1
pkgdesc='NIx Language server, an incremental analysis assistant for writing in Nix.'
arch=('x86_64')
url='https://github.com/oxalica/nil'
license=('MIT' 'APACHE-2.0')
makedepends=('cargo' 'nix' 'git')
source=("git+https://github.com/oxalica/nil")
sha256sums=('SKIP')

pkgver() {
  cd "$_pkgname"
  ( set -o pipefail
    git describe --long --abbrev=7 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
  )
}

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

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

build() {
  cd "$_pkgname"
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  cargo build --frozen --release --all-features
}

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