aports/testing/nix/APKBUILD
2023-11-09 06:41:39 +00:00

170 lines
4.3 KiB
Plaintext

# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=nix
pkgver=2.18.1
pkgrel=2
pkgdesc="The purely functional package manager"
url="https://nixos.org/nix/"
arch="x86 x86_64 aarch64" # supported platforms
license="LGPL-2.1-or-later"
depends="ca-certificates"
depends_dev="
boost-dev
gc-dev
"
makedepends="
$depends_dev
autoconf
autoconf-archive
automake
bash
bison
brotli-dev
bsd-compat-headers
busybox-static
bzip2-dev
coreutils
curl-dev
editline-dev
flex
gtest-dev
jq
libarchive-dev
libseccomp-dev
libsodium-dev
libtool
lowdown
lowdown-dev
mdbook
nlohmann-json
openssl-dev
sqlite-dev
xz
xz-dev
"
pkggroups="nix nixbld"
install="$pkgname.pre-install"
subpackages="
$pkgname-dev
$pkgname-openrc
$pkgname-manual::noarch
$pkgname-doc
$pkgname-bash-completion
$pkgname-fish-completion
$pkgname-zsh-completion
"
# TODO: Tests require rapidcheck which is a poorly maintained C++
# library without tagged releases, versioned sonames, and more.
# Hence, we really don't want to package it right now just for nix.
#
# See: https://github.com/emil-e/rapidcheck/issues/255
options="!check"
source="https://github.com/NixOS/nix/archive/$pkgver/nix-$pkgver.tar.gz
README.alpine
nix-remote.sh
nix-daemon.initd
fix-docs-build.patch
no-linkcheck.patch
"
case "$CARCH" in
x86*) makedepends="$makedepends libcpuid-dev";;
esac
prepare() {
default_prepare
./bootstrap.sh
}
build() {
# NOTE: /nix/var is recommended by upstream and we need /nix anyway.
bash ./configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--localstatedir=/nix/var \
--with-sandbox-shell=/bin/busybox.static \
--enable-embedded-sandbox-shell \
--enable-gc \
--disable-tests
make
}
check() {
make check
}
package() {
make DESTDIR="$pkgdir" install
cd "$pkgdir"
# We don't use systemd and only nix-daemon.sh is needed in
# /etc/profile.d for multi-user installations.
#
# See https://github.com/NixOS/nix/issues/5848
rm -R etc/init \
usr/lib/systemd \
etc/profile.d/nix.sh \
etc/profile.d/*.fish
mkdir -p usr/sbin
rm -f usr/bin/nix-daemon
ln -s ../bin/nix usr/sbin/nix-daemon
install -m 755 -D "$srcdir"/nix-remote.sh etc/profile.d/nix-remote.sh
install -m 755 -D "$srcdir"/nix-daemon.initd etc/init.d/nix-daemon
install -m 644 -D "$srcdir"/README.alpine \
"$pkgdir"/usr/share/doc/$pkgname/README.alpine
# Setup build users.
# Note: max-jobs should equal number of created nixbld<n> users.
install -d -m 0555 etc/nix
cat > etc/nix/nix.conf <<-EOF
build-users-group = nixbld
max-jobs = 4
EOF
# This is based on https://github.com/NixOS/nix/blob/9617a04/scripts/install-multi-user.sh#L525
# NOTE: store dir must be /nix/store, otherwise pre-built binaries from
# the standard Nixpkgs channels would not work.
install -d -m 1775 -g nixbld \
nix/store
install -d -m 0755 \
nix/var/log/nix/drvs \
nix/var/nix/db \
nix/var/nix/gcroots \
nix/var/nix/manifests \
nix/var/nix/profiles/default \
nix/var/nix/temproots \
nix/var/nix/userpool \
nix/var/nix/profile/per-user/root
install -d -m 1777 \
nix/var/nix/profiles/per-user \
nix/var/nix/gcroots/per-user
# Allow only users in the nix group to perform Nix operations.
install -d -m 0770 -g nix \
nix/var/nix/daemon-socket
}
manual() {
depends=""
pkgdesc="$pkgdesc (HTML manual)"
amove usr/share/doc/nix/manual
}
sha512sums="
4d36faf63666e5ec117b9daa6006414cb6f48439ee82687563af3eebc1a414eae17250e3550c347f88f8f720bbbc812c251bacb5e4542ae1905b458bcd9a5ae3 nix-2.18.1.tar.gz
f6a8d67003a6f0cd54dc4dc26051e9f3d18d9c1c1d66c99324e3db017891a6fdd88d7be53de05ab21fa8f7635164a093069416a89cf322ea6f6888df066ea60b README.alpine
ad02313f026fe3286c7c2271f26bf074ba2966c12777d7109275555f1a616bf0f99c8f5e45a57161f383091867f1dfd4d84cfae7a6d8a075312608456975dc81 nix-remote.sh
9e4568db987fbae5097f7bb086e8ad51742c2d229703104fb7e6f240ffb0ca72e57dc305fb238bcee4ec8002d780007af60f241b1f32b6aa413dd579d9c59e75 nix-daemon.initd
0d9214f27492b24f7b637efea38ddeec12b5db82ec39e6bbd84d0f080f6c03a9264a3e9a9b38fab904551bdddc8d067ddd96940f780bd2d8cfcee0fd3e586644 fix-docs-build.patch
4bf84827e2757a23680d4f3ad118d92d15010801343083dd362d291672a357d566a94f518afc36265628baaea2a0b1e4d87d33e53ba71e3c3ec7545fac66613e no-linkcheck.patch
"