1%undefine _hardened_build 2 3%global nixbld_user "nix-builder-" 4%global nixbld_group "nixbld" 5 6# NOTE: BUILD on EL7 requires 7# - Centos / RHEL7 software collection repository 8# yum install centos-release-scl 9# 10# - Recent boost backport 11# curl https://copr.fedorainfracloud.org/coprs/whosthere/boost/repo/epel-7/whosthere-boost-epel-7.repo -o /etc/yum.repos.d/whosthere-boost-epel-7.repo 12# 13 14# Disable documentation generation 15# necessary on some platforms 16%bcond_without docgen 17 18Summary: The Nix software deployment system 19Name: nix 20Version: @PACKAGE_VERSION@ 21Release: 2%{?dist} 22License: LGPLv2+ 23Group: Applications/System 24URL: http://nixos.org/ 25Source0: %{name}-%{version}.tar.bz2 26 27Requires: curl 28Requires: bzip2 29Requires: gzip 30Requires: xz 31BuildRequires: bison 32BuildRequires: boost-devel >= 1.60 33BuildRequires: bzip2-devel 34 35# for RHEL <= 7, we need software collections for a C++14 compatible compatible compiler 36%if 0%{?rhel} 37BuildRequires: devtoolset-7-gcc 38BuildRequires: devtoolset-7-gcc-c++ 39%endif 40 41BuildRequires: flex 42BuildRequires: libcurl-devel 43BuildRequires: libseccomp-devel 44BuildRequires: openssl-devel 45BuildRequires: sqlite-devel 46BuildRequires: xz-devel 47 48%description 49Nix is a purely functional package manager. It allows multiple 50versions of a package to be installed side-by-side, ensures that 51dependency specifications are complete, supports atomic upgrades and 52rollbacks, allows non-root users to install software, and has many 53other features. It is the basis of the NixOS Linux distribution, but 54it can be used equally well under other Unix systems. 55 56%package devel 57Summary: Development files for %{name} 58Requires: %{name}%{?_isa} = %{version}-%{release} 59 60%description devel 61The %{name}-devel package contains libraries and header files for 62developing applications that use %{name}. 63 64 65%package doc 66Summary: Documentation files for %{name} 67BuildArch: noarch 68Requires: %{name} = %{version}-%{release} 69 70%description doc 71The %{name}-doc package contains documentation files for %{name}. 72 73%prep 74%setup -q 75 76 77%build 78%if 0%{?rhel} 79source /opt/rh/devtoolset-7/enable 80%endif 81extraFlags= 82# - override docdir so large documentation files are owned by the 83# -doc subpackage 84# - set localstatedir by hand to the preferred nix value 85%configure --localstatedir=/nix/var \ 86 %{!?without_docgen:--disable-doc-gen} \ 87 --docdir=%{_defaultdocdir}/%{name}-doc-%{version} \ 88 $extraFlags 89make V=1 %{?_smp_mflags} 90 91 92%install 93%if 0%{?rhel} 94source /opt/rh/devtoolset-7/enable 95%endif 96 97make DESTDIR=$RPM_BUILD_ROOT install 98 99find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' 100 101# make the store 102mkdir -p $RPM_BUILD_ROOT/nix/store 103chmod 1775 $RPM_BUILD_ROOT/nix/store 104 105# make per-user directories 106for d in profiles gcroots; 107do 108 mkdir -p $RPM_BUILD_ROOT/nix/var/nix/$d/per-user 109 chmod 755 $RPM_BUILD_ROOT/nix/var/nix/$d/per-user 110done 111 112# fix permission of nix profile 113# (until this is fixed in the relevant Makefile) 114chmod -x $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/nix.sh 115 116# we ship this file in the base package 117rm -f $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}-doc-%{version}/README 118 119# Get rid of Upstart job. 120rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/init 121 122 123%clean 124rm -rf $RPM_BUILD_ROOT 125 126 127%pre 128getent group %{nixbld_group} >/dev/null || groupadd -r %{nixbld_group} 129for i in $(seq 10); 130do 131 getent passwd %{nixbld_user}$i >/dev/null || \ 132 useradd -r -g %{nixbld_group} -G %{nixbld_group} -d /var/empty \ 133 -s %{_sbindir}/nologin \ 134 -c "Nix build user $i" %{nixbld_user}$i 135done 136 137%post 138chgrp %{nixbld_group} /nix/store 139%if ! 0%{?rhel} || 0%{?rhel} >= 7 140# Enable and start Nix worker 141systemctl enable nix-daemon.socket nix-daemon.service 142systemctl start nix-daemon.socket 143%endif 144 145%files 146%license COPYING 147%{_bindir}/nix* 148%{_libdir}/*.so 149%{_prefix}/libexec/* 150%if ! 0%{?rhel} || 0%{?rhel} >= 7 151%{_prefix}/lib/systemd/system/nix-daemon.socket 152%{_prefix}/lib/systemd/system/nix-daemon.service 153%endif 154%{_datadir}/nix 155#%if ! %{without docgen} 156#%{_mandir}/man1/*.1* 157#%{_mandir}/man5/*.5* 158#%{_mandir}/man8/*.8* 159#%endif 160%config(noreplace) %{_sysconfdir}/profile.d/nix.sh 161%config(noreplace) %{_sysconfdir}/profile.d/nix-daemon.sh 162/nix 163 164%files devel 165%{_includedir}/nix 166%{_prefix}/lib/pkgconfig/*.pc 167 168 169#%if ! %{without docgen} 170#%files doc 171#%docdir %{_defaultdocdir}/%{name}-doc-%{version} 172#%{_defaultdocdir}/%{name}-doc-%{version} 173#%endif 174