Skip to content

Commit

Permalink
sys-apps/nix: add 2.23.0
Browse files Browse the repository at this point in the history
  • Loading branch information
trofi committed Jun 12, 2024
1 parent a3742c2 commit 4fba01a
Show file tree
Hide file tree
Showing 2 changed files with 191 additions and 0 deletions.
1 change: 1 addition & 0 deletions sys-apps/nix/Manifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ DIST nix-2.21.1.tar.gz 1512341 BLAKE2B 7bc87ca7e443eff89f7671a450dc8f3dbb813f0fc
DIST nix-2.21.2.tar.gz 1513013 BLAKE2B 3e0a30e16f520d557e46cf9a2a8eb417cd17fba292c3a99c80adbb620703a6fe34745237bd01b67f449586fc68235219664108a738ed887e2c8781ff285986ee SHA512 8bc5bdc2cce46ea8057e34e58b5d267f1bae7233ba596e226ccfda1f774cf61a8405e74d79c19de48cfff2e7815bac8564fd59f9c670e900b70cbb4baee16170
DIST nix-2.22.0.tar.gz 1582047 BLAKE2B 3bbaedc19503084c4a3ec38354aabf47799d5c2cfe2c5304a0d0d3b6d22873d146b67d31d4979998d3667700aabbb9e1ec0764d1fdc687b0030dec658303bb15 SHA512 dbbd4b9306ad6d60dad927bdee7ca7d10dcbb09bd87432430a9bfa0511374990e1e77f8fd5d4d533f33c46daca6356788db311847aecc924f2112ecb553edb7c
DIST nix-2.22.1.tar.gz 1582384 BLAKE2B 861985702ff8a5ba1e21ff3f228dc54cd2add1a7d29f83e2b665a6d691eb75d89fbb176795202013f5d57346d4c54f0a56b971ac316995908a79f4173e5827d6 SHA512 18c63b1344be3ec67481a321ed8ee02b49a9004f0c4c749cb175a8eccda8255cfb3ae95049f42a0847fd9f0da559e47f4e82808427d877ed1c855404be6ebf65
DIST nix-2.23.0.tar.gz 1618060 BLAKE2B 05271db430acea684a404246000aeef3b26ef01b544cc7fc10c2636c98b48c6d00f8174853241fbc6c8c246a7159f62f8ee6d08d4b763782c82dfed1ec40b5a3 SHA512 b89ecab5bc0352fc140b5ff37337bfaa1f5fb83bb9b3cc54dedbc41cf2bd8d7bfb0ec9fa42c3c27a61982445bb490cc38b160ff7d667495b429ee34d56ba5b15
190 changes: 190 additions & 0 deletions sys-apps/nix/nix-2.23.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
# 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=
dev-libs/libgit2: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-8.2.6[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-0_pre20231214
>=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
# dev-build/autoconf-archive: m4/ax_boost_base.m4, m4/ax_require_defined.m4
DEPEND+="
dev-build/autoconf-archive
virtual/pkgconfig
"

PATCHES=(
"${FILESDIR}"/${PN}-2.10-libpaths.patch
"${FILESDIR}"/${PN}-2.16-no-sandbox-fallback.patch
"${FILESDIR}"/${PN}-2.22-no-sandbox-fallback-README.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
# workaround unhandled AC_CONFIG_AUX_DIR in autotools.eclass:
# https://bugs.gentoo.org/927017
cp config.guess config/config.guess || die
cp config.sub config/config.sub || die

# rely on users settings
sed 's/GLOBAL_CXXFLAGS += -O3/GLOBAL_CXXFLAGS += /' -i 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 4fba01a

Please sign in to comment.