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 6/6] sys-apps/guix: switch from user.eclass to acct-*/ depends
Date: Sun, 24 Nov 2019 12:48:20
Message-Id: 20191124124616.691759-7-slyfox@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/6] nix and guix GID/UID assignments by Sergei Trofimovich
1 ---
2 sys-apps/guix/guix-1.0.1-r2.ebuild | 165 +++++++++++++++++++++++++++++
3 1 file changed, 165 insertions(+)
4 create mode 100644 sys-apps/guix/guix-1.0.1-r2.ebuild
5
6 diff --git a/sys-apps/guix/guix-1.0.1-r2.ebuild b/sys-apps/guix/guix-1.0.1-r2.ebuild
7 new file mode 100644
8 index 00000000000..1e8ec136e73
9 --- /dev/null
10 +++ b/sys-apps/guix/guix-1.0.1-r2.ebuild
11 @@ -0,0 +1,165 @@
12 +# Copyright 1999-2019 Gentoo Authors
13 +# Distributed under the terms of the GNU General Public License v2
14 +
15 +EAPI=7
16 +
17 +inherit autotools linux-info readme.gentoo-r1 systemd
18 +
19 +DESCRIPTION="GNU package manager (nix sibling)"
20 +HOMEPAGE="https://www.gnu.org/software/guix/"
21 +
22 +# taken from gnu/local.mk and gnu/packages/bootstrap.scm
23 +BOOT_GUILE=(
24 + "aarch64-linux 20170217 guile-2.0.14.tar.xz"
25 + "armhf-linux 20150101 guile-2.0.11.tar.xz"
26 + "i686-linux 20131110 guile-2.0.9.tar.xz"
27 + "mips64el-linux 20131110 guile-2.0.9.tar.xz"
28 + "x86_64-linux 20131110 guile-2.0.9.tar.xz"
29 +)
30 +
31 +binary_src_uris() {
32 + local system_date_guilep uri
33 + for system_date_guilep in "${BOOT_GUILE[@]}"; do
34 + # $1 $2 $3
35 + # "armhf-linux 20150101 guile-2.0.11.tar.xz"
36 + set -- ${system_date_guilep}
37 + uri="mirror://gnu-alpha/${PN}/bootstrap/$1/$2/$3"
38 + # ${uri} -> guix-bootstrap-armhf-linux-20150101-guile-2.0.11.tar.xz.bootstrap
39 + echo "${uri} -> guix-bootstrap-$1-$2-$3.bootstrap"
40 + done
41 +}
42 +
43 +# copy bootstrap binaries from DISTDIR to ${S}
44 +copy_boot_guile_binaries() {
45 + local system_date_guilep
46 + for system_date_guilep in "${BOOT_GUILE[@]}"; do
47 + # $1 $2 $3
48 + # "armhf-linux 20150101 guile-2.0.11.tar.xz"
49 + set -- ${system_date_guilep}
50 + cp "${DISTDIR}"/guix-bootstrap-$1-$2-$3.bootstrap gnu/packages/bootstrap/$1/$3 || die
51 + done
52 +}
53 +
54 +SRC_URI="mirror://gnu/${PN}/${P}.tar.gz
55 + $(binary_src_uris)"
56 +
57 +LICENSE="GPL-3"
58 +SLOT="0"
59 +KEYWORDS="~amd64 ~x86"
60 +IUSE=""
61 +
62 +RESTRICT=test # complains about size of config.log and refuses to start tests
63 +
64 +RDEPEND="
65 + dev-libs/libgcrypt:0=
66 + >=dev-scheme/guile-2.2:=[regex,networking,threads]
67 + dev-scheme/bytestructures
68 + dev-scheme/guile-gcrypt
69 + >=dev-scheme/guile-git-0.2.0
70 + dev-scheme/guile-json
71 + dev-scheme/guile-sqlite3
72 + net-libs/gnutls[guile]
73 + sys-libs/zlib
74 + app-arch/bzip2
75 + dev-db/sqlite
76 + acct-group/guixbuild
77 + acct-user/guixbuilder1
78 + acct-user/guixbuilder2
79 + acct-user/guixbuilder3
80 + acct-user/guixbuilder4
81 + acct-user/guixbuilder5
82 + acct-user/guixbuilder6
83 + acct-user/guixbuilder7
84 + acct-user/guixbuilder8
85 + acct-user/guixbuilder9
86 + acct-user/guixbuilder10
87 +"
88 +
89 +DEPEND="${RDEPEND}
90 +"
91 +
92 +PATCHES=("${FILESDIR}"/${PN}-0.16.0-default-daemon.patch)
93 +
94 +QA_PREBUILT="usr/share/guile/site/*/gnu/packages/bootstrap/*"
95 +
96 +DISABLE_AUTOFORMATTING=yes
97 +DOC_CONTENTS="Quick start user guide on Gentoo:
98 +
99 +[as root] allow binary substitution to be downloaded (optional)
100 + # guix archive --authorize < /usr/share/guix/ci.guix.info.pub
101 +[as root] enable guix-daemon service:
102 + [systemd] # systemctl enable guix-daemon
103 + [openrc] # rc-update add guix-daemon
104 +[as a user] ln -sf /var/guix/profiles/per-user/\$USER/guix-profile \$HOME/.guix-profile
105 +[as a user] install guix packages:
106 + \$ guix package -i hello
107 +[as a user] configure environment:
108 + Somewhere in .bash_profile you might want to set
109 + export GUIX_LOCPATH=\$HOME/.guix-profile/lib/locale
110 +
111 +Next steps:
112 + guix package manager user manual: https://www.gnu.org/software/guix/manual/guix.html
113 +"
114 +
115 +pkg_pretend() {
116 + # USER_NS is used to run builders in a default setting in linux
117 + # and for 'guix environment --container'.
118 + local CONFIG_CHECK="~USER_NS"
119 + check_extra_config
120 +}
121 +
122 +src_prepare() {
123 + copy_boot_guile_binaries
124 +
125 + default
126 + # build system is very eager to run automake itself: bug #625166
127 + eautoreconf
128 +
129 + # guile is trying to avoid recompilation by checking if file
130 + # /usr/lib64/guile/2.2/site-ccache/guix/modules.go
131 + # is newer than
132 + # guix/modules.scm
133 + # In case it is instead of using 'guix/modules.scm' guile
134 + # loads system one (from potentially older version of guix).
135 + # To work it around we bump last modification timestamp of
136 + # '*.scm' files.
137 + # http://debbugs.gnu.org/cgi/bugreport.cgi?bug=38112
138 + find "${S}" -name "*.scm" -exec touch {} + || die
139 +
140 + # Gentoo stores systemd unit files in lib, never in lib64: bug #689772
141 + sed -i nix/local.mk \
142 + -e 's|systemdservicedir = $(libdir)/systemd/system|systemdservicedir = '"$(systemd_get_systemunitdir)"'|' || die
143 +}
144 +
145 +src_configure() {
146 + # to be compatible with guix from /gnu/store
147 + econf \
148 + --localstatedir="${EPREFIX}"/var
149 +}
150 +
151 +src_compile() {
152 + # guile occasionally fails with 'bad address'
153 + emake -j1
154 +}
155 +
156 +src_install() {
157 + # TODO: emacs highlighter
158 + default
159 +
160 + readme.gentoo_create_doc
161 +
162 + keepdir /etc/guix
163 + # TODO: will need a tweak for prefix
164 + keepdir /gnu/store
165 + fowners root:guixbuild /gnu/store
166 + fperms 1775 /gnu/store
167 +
168 + keepdir /var/guix/profiles/per-user
169 + fperms 1777 /var/guix/profiles/per-user
170 +
171 + newinitd "${FILESDIR}"/guix-daemon.initd guix-daemon
172 +}
173 +
174 +pkg_postinst() {
175 + readme.gentoo_print_elog
176 +}
177 --
178 2.24.0