lix-releng-staging/nix.spec.in

155 lines
3.8 KiB
RPMSpec
Raw Normal View History

%undefine _hardened_build
%global nixbld_user "nix-builder-"
%global nixbld_group "nixbld"
Summary: The Nix software deployment system
Name: nix
Version: @PACKAGE_VERSION@
Release: 2%{?dist}
License: LGPLv2+
%if 0%{?rhel} && 0%{?rhel} < 7
Group: Applications/System
%endif
2008-08-29 13:59:03 +00:00
URL: http://nixos.org/
Source0: %{name}-%{version}.tar.bz2
%if 0%{?el5}
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
%endif
Requires: curl
2012-03-19 13:30:59 +00:00
Requires: bzip2
2013-05-14 13:10:14 +00:00
Requires: gzip
2012-12-05 11:17:12 +00:00
Requires: xz
2017-06-01 12:28:21 +00:00
Requires: libseccomp
Requires: boost-context
2012-03-19 13:30:59 +00:00
BuildRequires: bzip2-devel
BuildRequires: sqlite-devel
BuildRequires: libcurl-devel
2017-06-01 12:28:21 +00:00
BuildRequires: libseccomp-devel
BuildRequires: boost-devel
# Hack to make that shitty RPM scanning hack shut up.
2012-03-19 13:30:59 +00:00
Provides: perl(Nix::SSH)
%description
2007-03-21 12:39:55 +00:00
Nix is a purely functional package manager. It allows multiple
versions of a package to be installed side-by-side, ensures that
dependency specifications are complete, supports atomic upgrades and
rollbacks, allows non-root users to install software, and has many
other features. It is the basis of the NixOS Linux distribution, but
it can be used equally well under other Unix systems.
%package devel
Summary: Development files for %{name}
%if 0%{?rhel} && 0%{?rhel} < 7
Group: Development/Libraries
%endif
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%package doc
Summary: Documentation files for %{name}
%if 0%{?rhel} && 0%{?rhel} < 7
Group: Documentation
%endif
BuildArch: noarch
Requires: %{name} = %{version}-%{release}
%description doc
The %{name}-doc package contains documentation files for %{name}.
%prep
%setup -q
%build
extraFlags=
# - override docdir so large documentation files are owned by the
# -doc subpackage
# - set localstatedir by hand to the preferred nix value
%configure --localstatedir=/nix/var \
--docdir=%{_defaultdocdir}/%{name}-doc-%{version} \
$extraFlags
2017-02-21 13:52:36 +00:00
make -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES
%install
%if 0%{?el5}
rm -rf $RPM_BUILD_ROOT
%endif
make DESTDIR=$RPM_BUILD_ROOT install
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
# make the store
mkdir -p $RPM_BUILD_ROOT/nix/store
chmod 1775 $RPM_BUILD_ROOT/nix/store
# make per-user directories
for d in profiles gcroots;
do
2014-02-07 16:34:39 +00:00
mkdir -p $RPM_BUILD_ROOT/nix/var/nix/$d/per-user
chmod 1777 $RPM_BUILD_ROOT/nix/var/nix/$d/per-user
done
# fix permission of nix profile
# (until this is fixed in the relevant Makefile)
chmod -x $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/nix.sh
# we ship this file in the base package
2014-02-07 16:34:39 +00:00
rm -f $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}-doc-%{version}/README
# Get rid of Upstart job.
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/init
%clean
rm -rf $RPM_BUILD_ROOT
%pre
getent group %{nixbld_group} >/dev/null || groupadd -r %{nixbld_group}
for i in $(seq 10);
do
getent passwd %{nixbld_user}$i >/dev/null || \
useradd -r -g %{nixbld_group} -G %{nixbld_group} -d /var/empty \
-s %{_sbindir}/nologin \
-c "Nix build user $i" %{nixbld_user}$i
done
%post
chgrp %{nixbld_group} /nix/store
%if ! 0%{?rhel} || 0%{?rhel} >= 7
# Enable and start Nix worker
systemctl enable nix-daemon.socket nix-daemon.service
systemctl start nix-daemon.socket
%endif
%files
%{_bindir}/nix*
2014-02-07 16:34:39 +00:00
%{_libdir}/*.so
%{_prefix}/libexec/*
%if ! 0%{?rhel} || 0%{?rhel} >= 7
%{_prefix}/lib/systemd/system/nix-daemon.socket
2012-10-03 21:57:20 +00:00
%{_prefix}/lib/systemd/system/nix-daemon.service
%endif
%{_datadir}/nix
2012-07-09 17:16:09 +00:00
%{_mandir}/man1/*.1*
%{_mandir}/man5/*.5*
%{_mandir}/man8/*.8*
%config(noreplace) %{_sysconfdir}/profile.d/nix.sh
2017-10-24 13:44:29 +00:00
%config(noreplace) %{_sysconfdir}/profile.d/nix-daemon.sh
/nix
%files devel
%{_includedir}/nix
%{_prefix}/lib/pkgconfig/*.pc
%files doc
%docdir %{_defaultdocdir}/%{name}-doc-%{version}
%{_defaultdocdir}/%{name}-doc-%{version}