diff --git a/sys-apps/nix/Manifest b/sys-apps/nix/Manifest index f337f1a..b0ba250 100644 --- a/sys-apps/nix/Manifest +++ b/sys-apps/nix/Manifest @@ -1,3 +1,4 @@ +DIST nix-2.24.10.tar.gz 1655147 BLAKE2B 79524973ea6dbace6755ece012144525b01c3cd3d9dfb2d9499a4ab0e3171537e28069a72b05366f2a64ded0bf5f170da03430a5428af64e94a6e793cd97735a SHA512 32322c0a9a2c08da839d3c81b72d75630cde67d20a93ad15a5eb9d7fec545e7e935c0f11b979aca34ccd5004654ebb1436ce60d3a009b205b693bb8057f16733 DIST nix-2.24.5.tar.gz 1649695 BLAKE2B 15c12a109437363c6b56b2278ebd20b1866750548c579f88e883c73c463eeff2dbf00b922e42fcfdbb29dbad53d0b782f54f5fc0c7071ae48d31114d02ecb86f SHA512 64b507218ffd32cd5ecf00ef3e0d92d40dbd7e1819b4c488141ef554c962aa8eef30e99a35ea1262f2f8c48b4dd8416b83c6035d7a04c3780e392167430f78ce DIST nix-2.24.6.tar.gz 1651438 BLAKE2B c9f0c939cdc611bf9338d5f595db832595b09dc820429d9e62b466c3d07920c3033b9325f165f15ee47974915dfbe6c71596b3f358f732db2f75e13ad47983f5 SHA512 ac8d9e3207be7f2f2b1beaf09d1606b14338c3d988db9a5efa01913c56dcbb53d625992c401cb0b73c0c4f8a1e1d03e567c6cf52410b8e3fd80dd688ffca04de DIST nix-2.24.7.tar.gz 1652310 BLAKE2B f4d00ab80de0c676abf087471a5090766ee2dde6e28ec8bec8d6cfef9ba29acaaa016a132fc0fb9a26c98eb97f4912ecd614573e64768e0dca82b0db5b1216e5 SHA512 4e89b3d563687dc659420b30f181c289a35894417baaf7cd43ea620ae781197882315faaa72e03012744bb66fc30c32059d82892d59f25a6579138550c5bcbc6 diff --git a/sys-apps/nix/nix-2.24.10.ebuild b/sys-apps/nix/nix-2.24.10.ebuild new file mode 100644 index 0000000..7c8ac75 --- /dev/null +++ b/sys-apps/nix/nix-2.24.10.ebuild @@ -0,0 +1,195 @@ +# 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="+allocate-build-users +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 + allocate-build-users? ( +" +for i in {1..64}; do + RDEPEND+=" + >=acct-user/nixbld${i}-1 + " +done +RDEPEND+=" + ) +" +DEPEND="${RDEPEND} + dev-cpp/nlohmann_json + dev-cpp/toml11 + >=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 +}