Gentoo Archives: gentoo-dev

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-dev@l.g.o
Cc: Sergei Trofimovich <slyfox@g.o>
Subject: [gentoo-dev] [PATCH 5/6] sys-apps/nix: switch from user.eclass to acct-*/ depends
Date: Sun, 24 Nov 2019 12:48:25
Message-Id: 20191124124616.691759-6-slyfox@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/6] nix and guix GID/UID assignments by Sergei Trofimovich
1 Signed-off-by: Sergei Trofimovich <slyfox@g.o>
2 ---
3 sys-apps/nix/nix-2.3.1-r1.ebuild | 145 +++++++++++++++++++++++++++++++
4 1 file changed, 145 insertions(+)
5 create mode 100644 sys-apps/nix/nix-2.3.1-r1.ebuild
6
7 diff --git a/sys-apps/nix/nix-2.3.1-r1.ebuild b/sys-apps/nix/nix-2.3.1-r1.ebuild
8 new file mode 100644
9 index 00000000000..ef50b7bb65d
10 --- /dev/null
11 +++ b/sys-apps/nix/nix-2.3.1-r1.ebuild
12 @@ -0,0 +1,145 @@
13 +# Copyright 1999-2019 Gentoo Authors
14 +# Distributed under the terms of the GNU General Public License v2
15 +
16 +EAPI=7
17 +
18 +inherit autotools flag-o-matic linux-info readme.gentoo-r1
19 +
20 +DESCRIPTION="A purely functional package manager"
21 +HOMEPAGE="https://nixos.org/nix"
22 +
23 +SRC_URI="http://nixos.org/releases/${PN}/${P}/${P}.tar.xz"
24 +LICENSE="LGPL-2.1"
25 +SLOT="0"
26 +KEYWORDS="~amd64 ~x86"
27 +IUSE="+etc-profile +gc doc s3 +sodium"
28 +
29 +# sys-apps/busybox is needed for sandbox mount of /bin/sh
30 +RDEPEND="
31 + app-arch/brotli
32 + app-arch/bzip2
33 + app-arch/xz-utils
34 + sys-apps/busybox[static]
35 + dev-db/sqlite
36 + dev-libs/editline:0=
37 + dev-libs/openssl:0=
38 + >=dev-libs/boost-1.66:0=[context]
39 + net-misc/curl
40 + sys-libs/libseccomp
41 + sys-libs/zlib
42 + gc? ( dev-libs/boehm-gc[cxx] )
43 + doc? ( dev-libs/libxml2
44 + dev-libs/libxslt
45 + app-text/docbook-xsl-stylesheets
46 + )
47 + s3? ( dev-libs/aws-sdk-cpp )
48 + sodium? ( dev-libs/libsodium:0= )
49 + acct-group/nixbld
50 + acct-user/nixbld1
51 + acct-user/nixbld2
52 + acct-user/nixbld3
53 + acct-user/nixbld4
54 + acct-user/nixbld5
55 + acct-user/nixbld6
56 + acct-user/nixbld7
57 + acct-user/nixbld8
58 + acct-user/nixbld9
59 + acct-user/nixbld10
60 +"
61 +DEPEND="${RDEPEND}
62 + >=sys-devel/bison-2.6
63 + >=sys-devel/flex-2.5.35
64 +"
65 +
66 +PATCHES=(
67 + "${FILESDIR}"/${PN}-2.3-libpaths.patch
68 + "${FILESDIR}"/${PN}-2.3-bootstrap.patch
69 +)
70 +
71 +DISABLE_AUTOFORMATTING=yes
72 +DOC_CONTENTS=" Quick start user guide on Gentoo:
73 +
74 +[as root] enable nix-daemon service:
75 + [systemd] # systemctl enable nix-daemon
76 + [openrc] # rc-update add nix-daemon
77 +[as a user] relogin to get environment and profile update
78 +[as a user] fetch nixpkgs update:
79 + \$ nix-channel --update
80 +[as a user] install nix packages:
81 + \$ nix-env -i mc
82 +[as a user] configure environment:
83 + Somewhere in .bash_profile you might want to set
84 + LOCALE_ARCHIVE=\$HOME/.nix-profile/lib/locale/locale-archive
85 + but please read https://github.com/NixOS/nixpkgs/issues/21820
86 +
87 +Next steps:
88 + nix package manager user manual: http://nixos.org/nix/manual/
89 +"
90 +
91 +pkg_pretend() {
92 + # USER_NS is used to run builders in a default setting in linux:
93 + # https://nixos.wiki/wiki/Nix#Sandboxing
94 + local CONFIG_CHECK="~USER_NS"
95 + check_extra_config
96 +}
97 +
98 +src_prepare() {
99 + default
100 +
101 + eautoreconf
102 +}
103 +
104 +src_configure() {
105 + if ! use s3; then
106 + # Disable automagic depend: bug #670256
107 + export ac_cv_header_aws_s3_S3Client_h=no
108 + fi
109 + econf \
110 + --localstatedir="${EPREFIX}"/nix/var \
111 + $(use_enable gc) \
112 + --with-sandbox-shell=/bin/busybox
113 +}
114 +
115 +src_compile() {
116 + emake V=1
117 +}
118 +
119 +src_install() {
120 + # TODO: emacs highlighter
121 + default
122 +
123 + readme.gentoo_create_doc
124 +
125 + # here we use an eager variant of something that
126 + # is lazily done by nix-daemon and root nix-env
127 +
128 + # TODO: will need a tweak for prefix
129 + keepdir /nix/store
130 + fowners root:nixbld /nix/store
131 + fperms 1775 /nix/store
132 +
133 + keepdir /nix/var/nix/channel-cache
134 + fperms 0777 /nix/var/nix/channel-cache
135 +
136 + keepdir /nix/var/nix/profiles/per-user
137 + fperms 1777 /nix/var/nix/profiles/per-user
138 +
139 + # setup directories nix-daemon: /etc/profile.d/nix-daemon.sh
140 + keepdir /nix/var/nix/gcroots/per-user
141 + fperms 1777 /nix/var/nix/gcroots/per-user
142 +
143 + newinitd "${FILESDIR}"/nix-daemon.initd nix-daemon
144 +
145 + if ! use etc-profile; then
146 + rm "${ED}"/etc/profile.d/nix.sh || die
147 + rm "${ED}"/etc/profile.d/nix-daemon.sh || die
148 + fi
149 +}
150 +
151 +pkg_postinst() {
152 + if ! use etc-profile; then
153 + ewarn "${EROOT}/etc/profile.d/nix.sh was removed (due to USE=-etc-profile)."
154 + fi
155 +
156 + readme.gentoo_print_elog
157 +}
158 --
159 2.24.0