1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit autotools flag-o-matic readme.gentoo-r1 user
8 DESCRIPTION="A purely functional package manager"
9 HOMEPAGE="https://nixos.org/nix"
11 SRC_URI="http://nixos.org/releases/${PN}/${P}/${P}.tar.xz"
14 #keywords are blocked by boost-1.66
15 #KEYWORDS="~amd64 ~x86"
16 IUSE="+etc_profile +gc doc s3 sodium"
18 # sys-apps/busybox is needed for sandbox mount of /bin/sh
23 sys-apps/busybox[static]
27 >=dev-libs/boost-1.66:0=[context]
31 gc? ( dev-libs/boehm-gc[cxx] )
32 doc? ( dev-libs/libxml2
34 app-text/docbook-xsl-stylesheets
36 s3? ( dev-libs/aws-sdk-cpp )
37 sodium? ( dev-libs/libsodium:0= )
41 >=sys-devel/flex-2.5.35
45 "${FILESDIR}"/${PN}-1.11.6-systemd.patch
46 "${FILESDIR}"/${PN}-1.11.6-respect-CXXFLAGS.patch
47 "${FILESDIR}"/${PN}-1.11.6-respect-LDFLAGS.patch
48 "${FILESDIR}"/${PN}-2.0-user-path.patch
51 DISABLE_AUTOFORMATTING=yes
52 DOC_CONTENTS=" Quick start user guide on Gentoo:
54 [as root] enable nix-daemon service:
55 [systemd] # systemctl enable nix-daemon
56 [openrc] # rc-update add nix-daemon
57 [as a user] relogin to get environment and profile update
58 [as a user] fetch nixpkgs update:
59 \$ nix-channel --update
60 [as a user] install nix packages:
62 [as a user] configure environment:
63 Somewhere in .bash_profile you might want to set
64 LOCALE_ARCHIVE=\$HOME/.nix-profile/lib/locale/locale-archive
65 but please read https://github.com/NixOS/nixpkgs/issues/21820
68 nix package manager user manual: http://nixos.org/nix/manual/
74 # we list 'nixbld' twice to
75 # both assign a primary group for user
76 # and add a user to /etc/group
77 enewuser nixbld${i} -1 -1 /var/empty nixbld,nixbld
89 # Disable automagic depend: bug #670256
90 export ac_cv_header_aws_s3_S3Client_h=no
93 --localstatedir="${EPREFIX}"/nix/var \
95 --with-sandbox-shell=/bin/busybox
100 OPTIMIZE=0 # disable hardcoded -O3
103 emake "${make_vars[@]}"
107 # TODO: emacs highlighter
110 readme.gentoo_create_doc
112 # here we use an eager variant of something that
113 # is lazily done by nix-daemon and root nix-env
115 # TODO: will need a tweak for prefix
117 fowners root:nixbld /nix/store
118 fperms 1775 /nix/store
120 keepdir /nix/var/nix/channel-cache
121 fperms 0777 /nix/var/nix/channel-cache
123 keepdir /nix/var/nix/profiles/per-user
124 fperms 1777 /nix/var/nix/profiles/per-user
126 # setup directories nix-daemon: /etc/profile.d/nix-daemon.sh
127 keepdir /nix/var/nix/gcroots/per-user
128 fperms 1777 /nix/var/nix/gcroots/per-user
130 newinitd "${FILESDIR}"/nix-daemon.initd nix-daemon
132 if ! use etc_profile; then
133 rm "${ED}"/etc/profile.d/nix.sh || die
134 rm "${ED}"/etc/profile.d/nix-daemon.sh || die
139 if ! use etc_profile; then
140 ewarn "${EROOT}etc/profile.d/nix.sh was removed (due to USE=-etc_profile)."
143 readme.gentoo_print_elog