public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/nix/, sys-apps/nix/files/
@ 2017-08-31 20:23 Sergei Trofimovich
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Trofimovich @ 2017-08-31 20:23 UTC (permalink / raw
  To: gentoo-commits

commit:     008dca20d413d75867ec3959cbc6525926c7b9b3
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 31 20:22:15 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Aug 31 20:23:01 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=008dca20

sys-apps/nix: bump up to 1.11.14

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-apps/nix/Manifest                           |   1 +
 sys-apps/nix/files/nix-1.11.14-etc-fixes.patch  |   8 ++
 sys-apps/nix/files/nix-1.11.14-glibc-2.26.patch |  16 +++
 sys-apps/nix/nix-1.11.14.ebuild                 | 135 ++++++++++++++++++++++++
 4 files changed, 160 insertions(+)

diff --git a/sys-apps/nix/Manifest b/sys-apps/nix/Manifest
index 7e6ea0a73e8..3f4fb2cbe9d 100644
--- a/sys-apps/nix/Manifest
+++ b/sys-apps/nix/Manifest
@@ -1,3 +1,4 @@
 DIST nix-1.11.11.tar.xz 625248 SHA256 f5b9da21fb412e4c35b6e2bc771cfbf4ca44746be5d99868ff29d6e7604760e5 SHA512 b4652755860637dae0eacab3c536c43bb835614a802fd0bcc606f6140ae3f5c4db312d30ecb20dad62732d47cafb8101a8760b321be5ec4b331f298c59a79e4e WHIRLPOOL d4d8fc1d868832a9a0ca131bf26cfdd566279be00b56cd40d6e3035935dbdb55d5a77e460e96e77636b60542cd085ccd4e97e15f3c219ddf794b67eb3f3fd2d5
 DIST nix-1.11.12.tar.xz 631940 SHA256 02e8d85cfc02494fb04c90d8443dfea433639b9f787989b18f54567fd9769dd2 SHA512 fc2a06841cfa70c2d0b69315b0b8e30530e1b982e8a6b72e8f41c84db4efe7fc89738dce97f356f47d28518860990870fd54eb688704c531ba08231d2a3dd012 WHIRLPOOL b99e213e68cd479f9b6f8104e5f328c9bc409883aa1a88c155acf3f0a49ee95981f1774eff0d803b21182c0a087434a2910a9631dcaa97aae1847697473b27ea
 DIST nix-1.11.13.tar.xz 632224 SHA256 0913975e262f8069fde6e71a5fae757bb3aef558c51d1711034c525146ea5913 SHA512 7244b49a7c7416e6ecc7754abcf48028d650510ac27f26701ccc3954660e26ad8b083fdc4ae07de718d3df49ca2a6af3bf3261d537e962a90233f87b13cd1606 WHIRLPOOL a4af739a21e6080fccdfc885c24833e08765fae450fc7833484843f97fee7a4087619f67328075026b55efeda01a9cbf6bf80eb9918bdbbcee96414ee28d363c
+DIST nix-1.11.14.tar.xz 632260 SHA256 26593c831addf1d40f6b7d131f394cb0f9fbec9e46471369faed16eaa2c4b7e4 SHA512 48ed17a090a161ad35c8e84652566e527f31586184b8722a5536a6d83eee1e81911b6c4d5f0661f57054db6c47b5d8211f2acf47899fbec72f2c4bf8a5262af5 WHIRLPOOL d6db1f452dd5bb430a0e02644af89a3e648f3f0f898b81b60ef4d7b8c8d7c9498c0992c3c33637eafd3ff1d23f55df3b76e1a1da957a0b7066a88e3eff1c35ef

diff --git a/sys-apps/nix/files/nix-1.11.14-etc-fixes.patch b/sys-apps/nix/files/nix-1.11.14-etc-fixes.patch
new file mode 100644
index 00000000000..07962838a22
--- /dev/null
+++ b/sys-apps/nix/files/nix-1.11.14-etc-fixes.patch
@@ -0,0 +1,8 @@
+diff --git a/scripts/nix-profile.sh.in b/scripts/nix-profile.sh.in
+index 4f09b55..e93ef42 100644
+--- a/scripts/nix-profile.sh.in
++++ b/scripts/nix-profile.sh.in
+@@ -5,3 +5,2 @@ if [ -n "$HOME" ]; then
+     if ! [ -L "$NIX_LINK" ]; then
+-        echo "creating $NIX_LINK" >&2
+         _NIX_DEF_LINK=@localstatedir@/nix/profiles/per-user/$USER/profile

diff --git a/sys-apps/nix/files/nix-1.11.14-glibc-2.26.patch b/sys-apps/nix/files/nix-1.11.14-glibc-2.26.patch
new file mode 100644
index 00000000000..44c995e3239
--- /dev/null
+++ b/sys-apps/nix/files/nix-1.11.14-glibc-2.26.patch
@@ -0,0 +1,16 @@
+'context' is no more after:
+https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=251287734e89a52da3db682a8241eb6bccc050c9
+
+'ucontext_t' is the new name.
+diff --git a/src/libmain/stack.cc b/src/libmain/stack.cc
+index 41b617d..695aaad 100644
+--- a/src/libmain/stack.cc
++++ b/src/libmain/stack.cc
+@@ -22,5 +22,5 @@ static void sigsegvHandler(int signo, siginfo_t * info, void * ctx)
+ #if defined(__x86_64__) && defined(REG_RSP)
+-    sp = (char *) ((ucontext *) ctx)->uc_mcontext.gregs[REG_RSP];
++    sp = (char *) ((ucontext_t *) ctx)->uc_mcontext.gregs[REG_RSP];
+ #elif defined(REG_ESP)
+-    sp = (char *) ((ucontext *) ctx)->uc_mcontext.gregs[REG_ESP];
++    sp = (char *) ((ucontext_t *) ctx)->uc_mcontext.gregs[REG_ESP];
+ #else

diff --git a/sys-apps/nix/nix-1.11.14.ebuild b/sys-apps/nix/nix-1.11.14.ebuild
new file mode 100644
index 00000000000..55f0dba8e52
--- /dev/null
+++ b/sys-apps/nix/nix-1.11.14.ebuild
@@ -0,0 +1,135 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools flag-o-matic readme.gentoo-r1 user
+
+DESCRIPTION="A purely functional package manager"
+HOMEPAGE="https://nixos.org/nix"
+
+SRC_URI="http://nixos.org/releases/${PN}/${P}/${P}.tar.xz"
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+etc_profile +gc doc sodium"
+
+RDEPEND="
+	app-arch/bzip2
+	app-arch/xz-utils
+	dev-db/sqlite
+	dev-libs/openssl:0=
+	net-misc/curl
+	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 )
+	dev-lang/perl:=
+	dev-perl/DBD-SQLite
+	dev-perl/WWW-Curl
+	dev-perl/DBI
+"
+DEPEND="${RDEPEND}
+	>=sys-devel/bison-2.6
+	>=sys-devel/flex-2.5.35
+	virtual/perl-ExtUtils-ParseXS
+"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-1.11.6-systemd.patch
+	"${FILESDIR}"/${PN}-1.11.6-per-user.patch
+	"${FILESDIR}"/${PN}-1.11.6-respect-CXXFLAGS.patch
+	"${FILESDIR}"/${PN}-1.11.6-respect-LDFLAGS.patch
+	"${FILESDIR}"/${PN}-1.11.14-glibc-2.26.patch
+)
+
+DISABLE_AUTOFORMATTING=yes
+DOC_CONTENTS=" Quick start user guide on Gentoo:
+
+[as root] enable nix-daemon service:
+	[systemd] # systemctl enable nix-daemon
+	[openrc]  # rc-update add nix-daemon
+[as a user] relogin to get environment and profile update
+[as a user] fetch nixpkgs update:
+	\$ 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_setup() {
+	enewgroup nixbld
+	for i in {1..10}; do
+		# we list 'nixbld' twice to
+		# both assign a primary group for user
+		# and add a user to /etc/group
+		enewuser nixbld${i} -1 -1 /var/empty nixbld,nixbld
+	done
+}
+
+src_prepare() {
+	default
+
+	eautoreconf
+}
+
+src_configure() {
+	econf \
+		--localstatedir="${EPREFIX}"/nix/var \
+		$(use_enable gc)
+}
+
+src_compile() {
+	local make_vars=(
+		OPTIMIZE=0 # disable hardcoded -O3
+		V=1 # verbose build
+	)
+	emake "${make_vars[@]}"
+}
+
+src_install() {
+	# TODO: emacs highlighter
+	default
+
+	readme.gentoo_create_doc
+
+	# here we use an eager variant of something that
+	# is lazily done by nix-daemon and root nix-env
+
+	# TODO: will need a tweak for prefix
+	keepdir             /nix/store
+	fowners root:nixbld /nix/store
+	fperms 1775         /nix/store
+
+	keepdir             /nix/var/nix/profiles/per-user
+	fperms 1777         /nix/var/nix/profiles/per-user
+
+	# setup directories nix-daemon: /etc/profile.d/nix-daemon.sh
+	keepdir             /nix/var/nix/gcroots/per-user
+	fperms 1777         /nix/var/nix/gcroots/per-user
+
+	newinitd "${FILESDIR}"/nix-daemon.initd nix-daemon
+
+	if ! use etc_profile; then
+		rm "${ED}"/etc/profile.d/nix.sh || die
+		rm "${ED}"/etc/profile.d/nix-daemon.sh || die
+	fi
+}
+
+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
+}


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-apps/nix/, sys-apps/nix/files/
@ 2018-02-22 22:53 Sergei Trofimovich
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Trofimovich @ 2018-02-22 22:53 UTC (permalink / raw
  To: gentoo-commits

commit:     a4eac509af375f8c67e219415b3281c3a457678f
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 22 22:12:06 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Feb 22 22:53:10 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a4eac509

sys-apps/nix: bump up to 2.0

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 sys-apps/nix/Manifest                       |   1 +
 sys-apps/nix/files/nix-1.11.6-systemd.patch |   2 +-
 sys-apps/nix/files/nix-2.0-user-path.patch  |  10 +++
 sys-apps/nix/nix-2.0.ebuild                 | 133 ++++++++++++++++++++++++++++
 4 files changed, 145 insertions(+), 1 deletion(-)

diff --git a/sys-apps/nix/Manifest b/sys-apps/nix/Manifest
index 6de2c3842c5..89f05d13c91 100644
--- a/sys-apps/nix/Manifest
+++ b/sys-apps/nix/Manifest
@@ -1,2 +1,3 @@
 DIST nix-1.11.15.tar.xz 632544 BLAKE2B 3624c396c67a7c64e2ba16fd500951e6cf1b6f29f31929793072b5dfcdf1ffe40d5645c58d3967dd82d6c8d0bf6e5e2598a0d8d5fc3f82b22ea279a7854b1aca SHA512 449b3c78b74c776215dfbe9d6d09b96d8c6abf996c69c525073df12d0cffb1a2868890d356fbb52c794e2c6f485018756395625e7b170166f7c6f9e2bdd364d9
 DIST nix-1.11.16.tar.xz 632440 BLAKE2B 0b1966b1445a18616d6ff33e7fa3d1776626872c7cfeb54be4c77b998841db69f1e6aea7638edb21fa67442b953fb1cbaf7752c841d7d21f62dd63885a823834 SHA512 164f728c96fc6609134334e61f674961dfc0f02bd2f5d1d7800d2623fe80d896bfd0b7fba0a723b1bfe23663d4c7cf3e419a7c1992d67e80eb3d6b3bdf60a2a8
+DIST nix-2.0.tar.xz 794084 BLAKE2B 9596788df6aaad144d408e95f34575bf985849bb57424c7aac4dc1f2f2d846302bf78fc05682ce92fbaf000db04a326f867a76f5963a80b72b63e3678754247f SHA512 4531b4648108019d44521af94f8243936d2df62701395c0c448795f1984d4b5ade2438c92d12e5414d493909811e3bcb902c85539932c7e44d98d4254a2a531d

diff --git a/sys-apps/nix/files/nix-1.11.6-systemd.patch b/sys-apps/nix/files/nix-1.11.6-systemd.patch
index f890ee6f047..5a77d7c77e5 100644
--- a/sys-apps/nix/files/nix-1.11.6-systemd.patch
+++ b/sys-apps/nix/files/nix-1.11.6-systemd.patch
@@ -1,4 +1,4 @@
-Make 'nix-daemon' a goof unit for 'systemctl enable nix-daemon.service'.
+Make 'nix-daemon' a good unit for 'systemctl enable nix-daemon.service'.
 diff --git a/misc/systemd/nix-daemon.service.in b/misc/systemd/nix-daemon.service.in
 index 5fc04a3..2565520 100644
 --- a/misc/systemd/nix-daemon.service.in

diff --git a/sys-apps/nix/files/nix-2.0-user-path.patch b/sys-apps/nix/files/nix-2.0-user-path.patch
new file mode 100644
index 00000000000..486a05bb595
--- /dev/null
+++ b/sys-apps/nix/files/nix-2.0-user-path.patch
@@ -0,0 +1,10 @@
+On gentoo 'id' is /usr/bin/id while @coreutils@ is /bin.
+diff --git a/scripts/nix-profile.sh.in b/scripts/nix-profile.sh.in
+index a5f5227..1dc5379 100644
+--- a/scripts/nix-profile.sh.in
++++ b/scripts/nix-profile.sh.in
+@@ -2,3 +2,3 @@ if [ -n "$HOME" ] && [ -n "$USER" ]; then
+     __savedpath="$PATH"
+-    export PATH=@coreutils@
++    export PATH=@coreutils@:@prefix@/bin:@prefix@/../bin
+ 

diff --git a/sys-apps/nix/nix-2.0.ebuild b/sys-apps/nix/nix-2.0.ebuild
new file mode 100644
index 00000000000..bea6bd1a424
--- /dev/null
+++ b/sys-apps/nix/nix-2.0.ebuild
@@ -0,0 +1,133 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools flag-o-matic readme.gentoo-r1 user
+
+DESCRIPTION="A purely functional package manager"
+HOMEPAGE="https://nixos.org/nix"
+
+SRC_URI="http://nixos.org/releases/${PN}/${P}/${P}.tar.xz"
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+etc_profile +gc doc sodium"
+
+RDEPEND="
+	app-arch/brotli
+	app-arch/bzip2
+	app-arch/xz-utils
+	dev-db/sqlite
+	dev-libs/openssl:0=
+	net-misc/curl
+	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= )
+"
+DEPEND="${RDEPEND}
+	>=sys-devel/bison-2.6
+	>=sys-devel/flex-2.5.35
+"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-1.11.6-systemd.patch
+	"${FILESDIR}"/${PN}-1.11.6-respect-CXXFLAGS.patch
+	"${FILESDIR}"/${PN}-1.11.6-respect-LDFLAGS.patch
+	"${FILESDIR}"/${PN}-2.0-user-path.patch
+)
+
+DISABLE_AUTOFORMATTING=yes
+DOC_CONTENTS=" Quick start user guide on Gentoo:
+
+[as root] enable nix-daemon service:
+	[systemd] # systemctl enable nix-daemon
+	[openrc]  # rc-update add nix-daemon
+[as a user] relogin to get environment and profile update
+[as a user] fetch nixpkgs update:
+	\$ 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_setup() {
+	enewgroup nixbld
+	for i in {1..10}; do
+		# we list 'nixbld' twice to
+		# both assign a primary group for user
+		# and add a user to /etc/group
+		enewuser nixbld${i} -1 -1 /var/empty nixbld,nixbld
+	done
+}
+
+src_prepare() {
+	default
+
+	eautoreconf
+}
+
+src_configure() {
+	econf \
+		--localstatedir="${EPREFIX}"/nix/var \
+		$(use_enable gc)
+}
+
+src_compile() {
+	local make_vars=(
+		OPTIMIZE=0 # disable hardcoded -O3
+		V=1 # verbose build
+	)
+	emake "${make_vars[@]}"
+}
+
+src_install() {
+	# TODO: emacs highlighter
+	default
+
+	readme.gentoo_create_doc
+
+	# here we use an eager variant of something that
+	# is lazily done by nix-daemon and root nix-env
+
+	# TODO: will need a tweak for prefix
+	keepdir             /nix/store
+	fowners root:nixbld /nix/store
+	fperms 1775         /nix/store
+
+	keepdir             /nix/var/nix/channel-cache
+	fperms 0777         /nix/var/nix/channel-cache
+
+	keepdir             /nix/var/nix/profiles/per-user
+	fperms 1777         /nix/var/nix/profiles/per-user
+
+	# setup directories nix-daemon: /etc/profile.d/nix-daemon.sh
+	keepdir             /nix/var/nix/gcroots/per-user
+	fperms 1777         /nix/var/nix/gcroots/per-user
+
+	newinitd "${FILESDIR}"/nix-daemon.initd nix-daemon
+
+	if ! use etc_profile; then
+		rm "${ED}"/etc/profile.d/nix.sh || die
+		rm "${ED}"/etc/profile.d/nix-daemon.sh || die
+	fi
+}
+
+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
+}


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-apps/nix/, sys-apps/nix/files/
@ 2019-03-09 21:05 Sergei Trofimovich
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Trofimovich @ 2019-03-09 21:05 UTC (permalink / raw
  To: gentoo-commits

commit:     460014c2d82a53a5db86dd2376cbd7045227cc69
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Mar  9 21:04:43 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Mar  9 21:05:15 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=460014c2

sys-apps/nix: tweak for bdwgc-8, bug #679834

Reported-by: Toralf Förster
Closes: https://bugs.gentoo.org/679834
Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-apps/nix/files/nix-2.0.4-bdwgc-8.patch | 12 ++++++++++++
 sys-apps/nix/nix-2.0.4.ebuild              |  3 ++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/sys-apps/nix/files/nix-2.0.4-bdwgc-8.patch b/sys-apps/nix/files/nix-2.0.4-bdwgc-8.patch
new file mode 100644
index 00000000000..ff37f48e360
--- /dev/null
+++ b/sys-apps/nix/files/nix-2.0.4-bdwgc-8.patch
@@ -0,0 +1,12 @@
+Add a missing library for gdwgc-8
+--- a/configure.ac
++++ b/configure.ac
+@@ -226,6 +226,8 @@ AC_ARG_ENABLE(gc, AC_HELP_STRING([--enable-gc],
+ if test "$gc" = yes; then
+   PKG_CHECK_MODULES([BDW_GC], [bdw-gc])
+   CXXFLAGS="$BDW_GC_CFLAGS $CXXFLAGS"
++  # a workaround for https://bugs.gentoo.org/679834
++  BDW_GC_LIBS="$BDW_GC_LIBS -lgccpp"
+   AC_DEFINE(HAVE_BOEHMGC, 1, [Whether to use the Boehm garbage collector.])
+ fi
+ 

diff --git a/sys-apps/nix/nix-2.0.4.ebuild b/sys-apps/nix/nix-2.0.4.ebuild
index 965584cf6f0..a39c4d53087 100644
--- a/sys-apps/nix/nix-2.0.4.ebuild
+++ b/sys-apps/nix/nix-2.0.4.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Authors
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -41,6 +41,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-1.11.6-respect-CXXFLAGS.patch
 	"${FILESDIR}"/${PN}-1.11.6-respect-LDFLAGS.patch
 	"${FILESDIR}"/${PN}-2.0-user-path.patch
+	"${FILESDIR}"/${PN}-2.0.4-bdwgc-8.patch
 )
 
 DISABLE_AUTOFORMATTING=yes


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-apps/nix/, sys-apps/nix/files/
@ 2019-10-10 22:08 Sergei Trofimovich
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Trofimovich @ 2019-10-10 22:08 UTC (permalink / raw
  To: gentoo-commits

commit:     d230dd2ca9479868134a2278c8759f03a80e01e7
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 10 22:08:33 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Oct 10 22:08:48 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d230dd2c

sys-apps/nix: fix nix bootstrap, bug #693482

Fix `nix-channel --update` does not work on freshly-installed nix.

`nix-channel --update` does a few main things:
1. fetch new tarball with nix expressions
2. unpack that tarball as part of the build system using
   a shell script derived by unpack-channel.nix.
3. install the result into /nix/store

[2.] fails because tarball unpacking runs in a sandboxed environment
in a container with /nix/store and /bin/sh mounted.

unpack-channel.nix needs bash, tar and xz binaries in PATH.
These are normally provided by bash, tar and xz packages from /nix/store.

Unfortunately bash, tar and xz packages are not yet fetched as we
only have nix installed without nixpkgs tree.

1. we patch unpack-channel.nix to only require 'sh'
2. we use /bin/sh as a static busybox and point nix at it:
   ./configure --with-sandbox-shell=/bin/busybox

Reported-by: Kirill Zaborsky
Closes: https://bugs.gentoo.org/693482
Bug: https://github.com/NixOS/nix/issues/2673
Package-Manager: Portage-2.3.76, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-apps/nix/files/nix-2.3-bootstrap.patch |  58 ++++++++++++
 sys-apps/nix/nix-2.3-r1.ebuild             | 138 +++++++++++++++++++++++++++++
 2 files changed, 196 insertions(+)

diff --git a/sys-apps/nix/files/nix-2.3-bootstrap.patch b/sys-apps/nix/files/nix-2.3-bootstrap.patch
new file mode 100644
index 00000000000..fd656e0a1ec
--- /dev/null
+++ b/sys-apps/nix/files/nix-2.3-bootstrap.patch
@@ -0,0 +1,58 @@
+Fix `nix-channel --update` does not work on freshly-installed nix.
+
+# Why it does not work by default
+
+`nix-channel --update` does two main things:
+1. fetch new tarball with nix expressions
+2. unpack that tarball as part of the build system using
+   a shell script derived by unpack-channel.nix.
+3. install the result into /nix/store
+
+
+[2.] fails because tarball unpacking runs in a sandboxed environment
+a container with /nix/store and /bin/sh mounted.
+
+unpack-channel.nix needs bash, tar and xz binaries in PATH.
+These are normally provided by bash, tar and xz packages from /nix/store.
+
+Unfortunately bash, tar and xz packages are not yet fetched as we
+only have nix installed without nixpkgs tree.
+
+# How we get it working
+
+1. we patch unpack-channel.nix to only require 'sh'
+2. we use /bin/sh as a static busybox and point nix at it:
+   ./configure --with-sandbox-shell=/bin/busybox
+
+Bug: https://bugs.gentoo.org/693482
+Bug: https://github.com/NixOS/nix/issues/2673
+--- a/corepkgs/unpack-channel.nix
++++ b/corepkgs/unpack-channel.nix
+@@ -6,15 +6,9 @@ let
+     ''
+       mkdir $out
+       cd $out
+-      xzpat="\.xz\$"
+-      gzpat="\.gz\$"
+-      if [[ "$src" =~ $xzpat ]]; then
+-        ${xz} -d < $src | ${tar} xf - ${tarFlags}
+-      elif [[ "$src" =~ $gzpat ]]; then
+-        ${gzip} -d < $src | ${tar} xf - ${tarFlags}
+-      else
+-        ${bzip2} -d < $src | ${tar} xf - ${tarFlags}
+-      fi
++
++      tar xf $src
++
+       if [ * != $channelName ]; then
+         mv * $out/$channelName
+       fi
+@@ -26,7 +20,7 @@ in
+ 
+ derivation {
+   system = builtins.currentSystem;
+-  builder = shell;
++  builder = "/bin/sh";
+   args = [ "-e" builder ];
+   inherit name channelName src;
+ 

diff --git a/sys-apps/nix/nix-2.3-r1.ebuild b/sys-apps/nix/nix-2.3-r1.ebuild
new file mode 100644
index 00000000000..30e6c06b944
--- /dev/null
+++ b/sys-apps/nix/nix-2.3-r1.ebuild
@@ -0,0 +1,138 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools flag-o-matic readme.gentoo-r1 user
+
+DESCRIPTION="A purely functional package manager"
+HOMEPAGE="https://nixos.org/nix"
+
+SRC_URI="http://nixos.org/releases/${PN}/${P}/${P}.tar.xz"
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+etc-profile +gc doc s3 +sodium"
+
+# sys-apps/busybox is needed for sandbox mount of /bin/sh
+RDEPEND="
+	app-arch/brotli
+	app-arch/bzip2
+	app-arch/xz-utils
+	sys-apps/busybox[static]
+	dev-db/sqlite
+	dev-libs/editline:0=
+	dev-libs/openssl:0=
+	>=dev-libs/boost-1.66:0=[context]
+	net-misc/curl
+	sys-libs/libseccomp
+	sys-libs/zlib
+	gc? ( dev-libs/boehm-gc[cxx] )
+	doc? ( dev-libs/libxml2
+		dev-libs/libxslt
+		app-text/docbook-xsl-stylesheets
+	)
+	s3? ( dev-libs/aws-sdk-cpp )
+	sodium? ( dev-libs/libsodium:0= )
+"
+DEPEND="${RDEPEND}
+	>=sys-devel/bison-2.6
+	>=sys-devel/flex-2.5.35
+"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-2.0-user-path.patch
+	"${FILESDIR}"/${PN}-2.3-libpaths.patch
+	"${FILESDIR}"/${PN}-2.3-bootstrap.patch
+)
+
+DISABLE_AUTOFORMATTING=yes
+DOC_CONTENTS=" Quick start user guide on Gentoo:
+
+[as root] enable nix-daemon service:
+	[systemd] # systemctl enable nix-daemon
+	[openrc]  # rc-update add nix-daemon
+[as a user] relogin to get environment and profile update
+[as a user] fetch nixpkgs update:
+	\$ 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_setup() {
+	enewgroup nixbld
+	for i in {1..10}; do
+		# we list 'nixbld' twice to
+		# both assign a primary group for user
+		# and add a user to /etc/group
+		enewuser nixbld${i} -1 -1 /var/empty nixbld,nixbld
+	done
+}
+
+src_prepare() {
+	default
+
+	eautoreconf
+}
+
+src_configure() {
+	if ! use s3; then
+		# Disable automagic depend: bug #670256
+		export ac_cv_header_aws_s3_S3Client_h=no
+	fi
+	econf \
+		--localstatedir="${EPREFIX}"/nix/var \
+		$(use_enable gc) \
+		--with-sandbox-shell=/bin/busybox
+}
+
+src_compile() {
+	emake V=1
+}
+
+src_install() {
+	# TODO: emacs highlighter
+	default
+
+	readme.gentoo_create_doc
+
+	# here we use an eager variant of something that
+	# is lazily done by nix-daemon and root nix-env
+
+	# TODO: will need a tweak for prefix
+	keepdir             /nix/store
+	fowners root:nixbld /nix/store
+	fperms 1775         /nix/store
+
+	keepdir             /nix/var/nix/channel-cache
+	fperms 0777         /nix/var/nix/channel-cache
+
+	keepdir             /nix/var/nix/profiles/per-user
+	fperms 1777         /nix/var/nix/profiles/per-user
+
+	# setup directories nix-daemon: /etc/profile.d/nix-daemon.sh
+	keepdir             /nix/var/nix/gcroots/per-user
+	fperms 1777         /nix/var/nix/gcroots/per-user
+
+	newinitd "${FILESDIR}"/nix-daemon.initd nix-daemon
+
+	if ! use etc-profile; then
+		rm "${ED}"/etc/profile.d/nix.sh || die
+		rm "${ED}"/etc/profile.d/nix-daemon.sh || die
+	fi
+}
+
+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
+}


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-10 22:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-22 22:53 [gentoo-commits] repo/gentoo:master commit in: sys-apps/nix/, sys-apps/nix/files/ Sergei Trofimovich
  -- strict thread matches above, loose matches on Subject: below --
2019-10-10 22:08 Sergei Trofimovich
2019-03-09 21:05 Sergei Trofimovich
2017-08-31 20:23 Sergei Trofimovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox