sys-apps/openrc: stable 0.41.2 for ia64, bug #684900
[gentoo.git] / sys-apps / nix / nix-2.1.3.ebuild
1 # Copyright 1999-2018 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit autotools flag-o-matic readme.gentoo-r1 user
7
8 DESCRIPTION="A purely functional package manager"
9 HOMEPAGE="https://nixos.org/nix"
10
11 SRC_URI="http://nixos.org/releases/${PN}/${P}/${P}.tar.xz"
12 LICENSE="LGPL-2.1"
13 SLOT="0"
14 #keywords are blocked by boost-1.66
15 #KEYWORDS="~amd64 ~x86"
16 IUSE="+etc_profile +gc doc s3 sodium"
17
18 RDEPEND="
19         app-arch/brotli
20         app-arch/bzip2
21         app-arch/xz-utils
22         dev-db/sqlite
23         dev-libs/openssl:0=
24         >=dev-libs/boost-1.66:0=[context]
25         net-misc/curl
26         sys-libs/libseccomp
27         sys-libs/zlib
28         gc? ( dev-libs/boehm-gc[cxx] )
29         doc? ( dev-libs/libxml2
30                 dev-libs/libxslt
31                 app-text/docbook-xsl-stylesheets
32         )
33         s3? ( dev-libs/aws-sdk-cpp )
34         sodium? ( dev-libs/libsodium:0= )
35 "
36 DEPEND="${RDEPEND}
37         >=sys-devel/bison-2.6
38         >=sys-devel/flex-2.5.35
39 "
40
41 PATCHES=(
42         "${FILESDIR}"/${PN}-1.11.6-systemd.patch
43         "${FILESDIR}"/${PN}-1.11.6-respect-CXXFLAGS.patch
44         "${FILESDIR}"/${PN}-1.11.6-respect-LDFLAGS.patch
45         "${FILESDIR}"/${PN}-2.0-user-path.patch
46 )
47
48 DISABLE_AUTOFORMATTING=yes
49 DOC_CONTENTS=" Quick start user guide on Gentoo:
50
51 [as root] enable nix-daemon service:
52         [systemd] # systemctl enable nix-daemon
53         [openrc]  # rc-update add nix-daemon
54 [as a user] relogin to get environment and profile update
55 [as a user] fetch nixpkgs update:
56         \$ nix-channel --update
57 [as a user] install nix packages:
58         \$ nix-env -i mc
59 [as a user] configure environment:
60         Somewhere in .bash_profile you might want to set
61         LOCALE_ARCHIVE=\$HOME/.nix-profile/lib/locale/locale-archive
62         but please read https://github.com/NixOS/nixpkgs/issues/21820
63
64 Next steps:
65         nix package manager user manual: http://nixos.org/nix/manual/
66 "
67
68 pkg_setup() {
69         enewgroup nixbld
70         for i in {1..10}; do
71                 # we list 'nixbld' twice to
72                 # both assign a primary group for user
73                 # and add a user to /etc/group
74                 enewuser nixbld${i} -1 -1 /var/empty nixbld,nixbld
75         done
76 }
77
78 src_prepare() {
79         default
80
81         eautoreconf
82 }
83
84 src_configure() {
85         local econf_args=()
86
87         if ! use s3; then
88                 # Disable automagic depend: bug #670256
89                 export ac_cv_header_aws_s3_S3Client_h=no
90         fi
91         econf \
92                 --localstatedir="${EPREFIX}"/nix/var \
93                 $(use_enable gc) \
94                 "${args[@]}"
95 }
96
97 src_compile() {
98         local make_vars=(
99                 OPTIMIZE=0 # disable hardcoded -O3
100                 V=1 # verbose build
101         )
102         emake "${make_vars[@]}"
103 }
104
105 src_install() {
106         # TODO: emacs highlighter
107         default
108
109         readme.gentoo_create_doc
110
111         # here we use an eager variant of something that
112         # is lazily done by nix-daemon and root nix-env
113
114         # TODO: will need a tweak for prefix
115         keepdir             /nix/store
116         fowners root:nixbld /nix/store
117         fperms 1775         /nix/store
118
119         keepdir             /nix/var/nix/channel-cache
120         fperms 0777         /nix/var/nix/channel-cache
121
122         keepdir             /nix/var/nix/profiles/per-user
123         fperms 1777         /nix/var/nix/profiles/per-user
124
125         # setup directories nix-daemon: /etc/profile.d/nix-daemon.sh
126         keepdir             /nix/var/nix/gcroots/per-user
127         fperms 1777         /nix/var/nix/gcroots/per-user
128
129         newinitd "${FILESDIR}"/nix-daemon.initd nix-daemon
130
131         if ! use etc_profile; then
132                 rm "${ED}"/etc/profile.d/nix.sh || die
133                 rm "${ED}"/etc/profile.d/nix-daemon.sh || die
134         fi
135 }
136
137 pkg_postinst() {
138         if ! use etc_profile; then
139                 ewarn "${EROOT}etc/profile.d/nix.sh was removed (due to USE=-etc_profile)."
140         fi
141
142         readme.gentoo_print_elog
143 }