Skip to content

Commit

Permalink
sys-apps/nix: add 2.19.2
Browse files Browse the repository at this point in the history
  • Loading branch information
trofi committed Nov 29, 2023
1 parent 6b6f69c commit 68ce7ed
Show file tree
Hide file tree
Showing 2 changed files with 188 additions and 0 deletions.
1 change: 1 addition & 0 deletions sys-apps/nix/Manifest
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DIST nix-2.18.1.tar.gz 1376442 BLAKE2B 48a08eeb87238fb3c285e9bb618a073e1348f0a00f2d247be11dcae7dcf428281123039dee5772839087013d9d5790966ad6a8be1188b816518bd60f4dcccc00 SHA512 4d36faf63666e5ec117b9daa6006414cb6f48439ee82687563af3eebc1a414eae17250e3550c347f88f8f720bbbc812c251bacb5e4542ae1905b458bcd9a5ae3
DIST nix-2.19.0.tar.gz 1442276 BLAKE2B 5c59399d98e6006c20d0f2cb5f777fdf253974ae900365a7fc4e0e4fd24cdfb35a139556f0a17058df3612e668e72df9a40deedde446bb27065d27e9b60a578f SHA512 7eca4e568bbd53de4aee4417c4c9d0e52d9ede6a4c57a8c5b8dd8c0d437340162fb7fb09a8719b30b68d3edfd31134bb3c2befb589a21338ac2cf0d4a7ab5e62
DIST nix-2.19.1.tar.gz 1442296 BLAKE2B 7c84c971f64ae85437f831bef944d70701fa6dd24ec5ad4fefd596074ff111ee5404af4cde989e142fa0f3106b6c71b01a0dd986695ca261771dee30e0c4ad80 SHA512 0d0be96eef7aa3ea0b620eceea16090a61b9ed4238dcba06f8a355b6562700bb47579a9f0962519cd25e9221c08c6d04a2fe16ef9c167d9f3012dda45a05a058
DIST nix-2.19.2.tar.gz 1442534 BLAKE2B d3294dac20f58831fc78d4977ea1c91b12444436a24501a0789cac368a53c915e28b7f53c7d2fd45e819812ee742e057bd391ed989ea26e3aea2444c9ee60ef7 SHA512 a621092afbbbd37d956bc934f5f71c6209d70df997b0123970af5510afe3445562511bb25dab483ca90b3d5871560e0ce8f9fa727d90d2f969ba8104fe09986f
187 changes: 187 additions & 0 deletions sys-apps/nix/nix-2.19.2.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit autotools linux-info readme.gentoo-r1 tmpfiles toolchain-funcs

DESCRIPTION="A purely functional package manager"
HOMEPAGE="https://nixos.org/nix"

SRC_URI="https://github.com/NixOS/nix/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64"
IUSE="+etc-profile +gc doc +sodium"

BDEPEND="
doc? ( app-text/mdbook
app-text/mdbook-linkcheck
)
"
# sys-apps/busybox-nix-sandbox-shell is needed for sandbox mount of /bin/sh
RDEPEND="
app-arch/brotli
app-arch/bzip2
app-arch/xz-utils
app-misc/jq
app-text/lowdown-nix
dev-cpp/gtest
dev-db/sqlite
dev-libs/editline:0=
amd64? ( dev-libs/libcpuid:0= )
dev-libs/openssl:0=
>=dev-libs/boost-1.66:0=[context]
net-misc/curl
sys-apps/busybox-nix-sandbox-shell
sys-libs/libseccomp
sys-libs/zlib
gc? ( dev-libs/boehm-gc[cxx] )
doc? ( dev-libs/libxml2
dev-libs/libxslt
app-text/docbook-xsl-stylesheets
)
sodium? ( dev-libs/libsodium:0= )
"
# add users and groups
RDEPEND+="
acct-group/nixbld
"
for i in {1..64}; do
RDEPEND+="
>=acct-user/nixbld${i}-1
"
done
DEPEND="${RDEPEND}
dev-cpp/nlohmann_json
dev-cpp/rapidcheck
>=sys-devel/bison-2.6
>=sys-devel/flex-2.5.35
"

# Upstream does not bundle .m4 files, extract from upstreams:
# dev-util/pkgconfig: m4/pkg.m4
# sys-devel/autoconf-archive: m4/ax_boost_base.m4, m4/ax_require_defined.m4
DEPEND+="
sys-devel/autoconf-archive
virtual/pkgconfig
"

PATCHES=(
"${FILESDIR}"/${PN}-2.10-libpaths.patch
"${FILESDIR}"/${PN}-2.16-no-sandbox-fallback.patch
"${FILESDIR}"/${PN}-2.16-no-sandbox-fallback-README.patch
"${FILESDIR}"/${PN}-2.19-DESTDIR.patch
)

DISABLE_AUTOFORMATTING=yes
DOC_CONTENTS=" Quick start user guide on Gentoo:
[as root] enable nix-daemon service:
[systemd] # systemctl enable nix-daemon && systemctl start nix-daemon
[openrc] # rc-update add nix-daemon && /etc/init.d/nix-daemon start
[as a user] relogin to get environment and profile update
[as a user] fetch nixpkgs update:
\$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable
\$ nix-channel --update
[as a user] install nix packages:
\$ nix-env -i mc
[as a user] configure environment:
Somewhere in .bash_profile you might want to set
LOCALE_ARCHIVE=\$HOME/.nix-profile/lib/locale/locale-archive
but please read https://github.com/NixOS/nixpkgs/issues/21820
Next steps:
nix package manager user manual: http://nixos.org/nix/manual/
"

pkg_pretend() {
# USER_NS is used to run builders in a default setting in linux:
# https://nixos.wiki/wiki/Nix#Sandboxing
local CONFIG_CHECK="~USER_NS"
check_extra_config
}

src_prepare() {
default

eautoreconf

# rely on users settings
sed 's/GLOBAL_CXXFLAGS += -O3/GLOBAL_CXXFLAGS += /' -i Makefile || die
sed 's/GLOBAL_CXXFLAGS += -O3/GLOBAL_CXXFLAGS += /' -i perl/Makefile || die

# inject our copy of lowdown-nix
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}${PKG_CONFIG_PATH:+:}${EPREFIX}/usr/$(get_libdir)/lowdown-nix/lib/pkgconfig"
export PATH="$PATH:${EPREFIX}/usr/$(get_libdir)/lowdown-nix/bin"

# inject rapidcheck extra includes
export CXXFLAGS="${CXXFLAGS} -I${EPREFIX}/usr/include/rapidcheck/extras/gtest/include"
}

src_configure() {
CONFIG_SHELL="${BROOT}/bin/bash" econf \
--localstatedir="${EPREFIX}"/nix/var \
$(use_enable gc) \
$(use_enable doc doc-gen) \
--with-sandbox-shell="${EPREFIX}"/usr/bin/busybox-nix-sandbox-shell

emake Makefile.config # gets generated late
cat >> Makefile.config <<-EOF
V = 1
CC = $(tc-getCC)
CXX = $(tc-getCXX)
EOF
}

src_compile() {
# Upstream does not support building without installation.
# Rely on src_install's DESTDIR=.
:
}

src_install() {
# TODO: emacs highlighter
default

readme.gentoo_create_doc

# TODO: will need a tweak for prefix

# Follow the steps of 'scripts/install-multi-user.sh:create_directories()'
local dir dirs=(
/nix
/nix/var
/nix/var/log
/nix/var/log/nix
/nix/var/log/nix/drvs
/nix/var/nix{,/db,/gcroots,/profiles,/temproots,/userpool,/daemon-socket}
/nix/var/nix/{gcroots,profiles}/per-user
)
for dir in "${dirs[@]}"; do
keepdir "${dir}"
fperms 0755 "${dir}"
done

keepdir /nix/store
fowners root:nixbld /nix/store
fperms 1775 /nix/store

newinitd "${FILESDIR}"/nix-daemon.initd nix-daemon

if ! use etc-profile; then
rm "${ED}"/etc/profile.d/nix.sh || die
fi
# nix-daemon.sh should not be used for users' profile.
# Only for daemon itself.
rm "${ED}"/etc/profile.d/nix-daemon.sh || die
}

pkg_postinst() {
if ! use etc-profile; then
ewarn "${EROOT}/etc/profile.d/nix.sh was removed (due to USE=-etc-profile)."
fi

readme.gentoo_print_elog
tmpfiles_process nix-daemon.conf
}

0 comments on commit 68ce7ed

Please sign in to comment.