forked from lix-project/lix
Major spec update: - Fix license field - Split into subpackages - Update build dependencies - Configure users and groups for multi-user mode - Fix installation location of Perl modules
This commit is contained in:
parent
6a214f3e06
commit
8922346305
195
nix.spec.in
195
nix.spec.in
|
@ -1,32 +1,26 @@
|
||||||
%global enable_setuid ""
|
%global nixbld_user "nix-builder-"
|
||||||
%global nix_user "nix"
|
%global nixbld_group "nix-builders"
|
||||||
%global nix_group "nix"
|
|
||||||
|
|
||||||
# If set, the Nix user and group will be created by the RPM
|
|
||||||
# pre-install script.
|
|
||||||
%global nix_user_uid ""
|
|
||||||
%global nix_group_gid ""
|
|
||||||
|
|
||||||
Summary: The Nix software deployment system
|
Summary: The Nix software deployment system
|
||||||
Name: nix
|
Name: nix
|
||||||
Version: @version@
|
Version: @version@
|
||||||
Release: 1
|
Release: 2%{?dist}
|
||||||
License: GPL
|
License: LGPLv2+
|
||||||
%if 0%{?rhel}
|
%if 0%{?rhel}
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
%endif
|
%endif
|
||||||
URL: http://nixos.org/
|
URL: http://nixos.org/
|
||||||
Source0: %{name}-@version@.tar.bz2
|
Source0: %{name}-%{version}.tar.bz2
|
||||||
%if 0%{?el5}
|
%if 0%{?el5}
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
||||||
%endif
|
%endif
|
||||||
|
BuildRequires: perl(DBD::SQLite)
|
||||||
|
BuildRequires: perl(DBI)
|
||||||
|
BuildRequires: perl(ExtUtils::ParseXS)
|
||||||
Requires: /usr/bin/perl
|
Requires: /usr/bin/perl
|
||||||
Requires: curl
|
Requires: curl
|
||||||
Requires: perl-DBD-SQLite
|
Requires: perl-DBD-SQLite
|
||||||
Requires: perl-devel
|
|
||||||
Requires: bzip2
|
Requires: bzip2
|
||||||
Requires: bzip2-libs
|
|
||||||
Requires: sqlite
|
|
||||||
BuildRequires: bzip2-devel
|
BuildRequires: bzip2-devel
|
||||||
BuildRequires: sqlite-devel
|
BuildRequires: sqlite-devel
|
||||||
|
|
||||||
|
@ -34,7 +28,6 @@ BuildRequires: sqlite-devel
|
||||||
Provides: perl(Nix::SSH)
|
Provides: perl(Nix::SSH)
|
||||||
|
|
||||||
%description
|
%description
|
||||||
|
|
||||||
Nix is a purely functional package manager. It allows multiple
|
Nix is a purely functional package manager. It allows multiple
|
||||||
versions of a package to be installed side-by-side, ensures that
|
versions of a package to be installed side-by-side, ensures that
|
||||||
dependency specifications are complete, supports atomic upgrades and
|
dependency specifications are complete, supports atomic upgrades and
|
||||||
|
@ -42,55 +35,165 @@ rollbacks, allows non-root users to install software, and has many
|
||||||
other features. It is the basis of the NixOS Linux distribution, but
|
other features. It is the basis of the NixOS Linux distribution, but
|
||||||
it can be used equally well under other Unix systems.
|
it can be used equally well under other Unix systems.
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Summary: Development files for %{name}
|
||||||
|
%if 0%{?rhel}
|
||||||
|
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}
|
||||||
|
Group: Documentation
|
||||||
|
%endif
|
||||||
|
BuildArch: noarch
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
|
||||||
|
%description doc
|
||||||
|
The %{name}-doc package contains documentation files for %{name}.
|
||||||
|
|
||||||
|
|
||||||
|
%package -n emacs-%{name}
|
||||||
|
Summary: Nix mode for Emacs
|
||||||
|
%if 0%{?rhel}
|
||||||
|
Group: Applications/Editors
|
||||||
|
%endif
|
||||||
|
BuildArch: noarch
|
||||||
|
BuildRequires: emacs
|
||||||
|
Requires: emacs(bin) >= %{_emacs_version}
|
||||||
|
|
||||||
|
%description -n emacs-%{name}
|
||||||
|
This package provides a major mode for editing Nix expressions.
|
||||||
|
|
||||||
|
%package -n emacs-%{name}-el
|
||||||
|
Summary: Elisp source files for emacs-%{name}
|
||||||
|
%if 0%{?rhel}
|
||||||
|
Group: Applications/Editors
|
||||||
|
%endif
|
||||||
|
BuildArch: noarch
|
||||||
|
Requires: emacs-%{name} = %{version}-%{release}
|
||||||
|
|
||||||
|
%description -n emacs-%{name}-el
|
||||||
|
This package contains the elisp source file for the Nix major mode for
|
||||||
|
GNU Emacs. You do not need to install this package to run Nix. Install
|
||||||
|
the emacs-%{name} package to edit Nix expressions with GNU Emacs.
|
||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
# Install Perl modules to vendor_perl
|
||||||
|
# configure.ac need to be changed to make this global; however, this will
|
||||||
|
# also affect NixOS. Use discretion.
|
||||||
|
%{__sed} -i 's|perl5/site_perl/$perlversion/$perlarchname|perl5/vendor_perl|' \
|
||||||
|
configure
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
extraFlags=
|
extraFlags=
|
||||||
if test -n "%{enable_setuid}"; then
|
# - override docdir so large documentation files are owned by the
|
||||||
extraFlags="$extraFlags --enable-setuid"
|
# -doc subpackage
|
||||||
if test -n "%{nix_user}"; then
|
# - set localstatedir by hand to the preferred nix value
|
||||||
extraFlags="$extraFlags --with-nix-user=%{nix_user}"
|
%configure --localstatedir=/nix/var \
|
||||||
fi
|
--docdir=%{_defaultdocdir}/%{name}-doc-%{version} \
|
||||||
if test -n "%{nix_group}"; then
|
$extraFlags
|
||||||
extraFlags="$extraFlags --with-nix-group=%{nix_group}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
%configure $extraFlags
|
|
||||||
make %{?_smp_flags}
|
make %{?_smp_flags}
|
||||||
|
%{_emacs_bytecompile} misc/emacs/nix-mode.el
|
||||||
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%if 0%{?el5}
|
%if 0%{?el5}
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
%endif
|
%endif
|
||||||
make DESTDIR=$RPM_BUILD_ROOT install
|
make DESTDIR=$RPM_BUILD_ROOT install
|
||||||
rm $RPM_BUILD_ROOT/etc/nix/nix.conf
|
|
||||||
|
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
|
||||||
|
|
||||||
|
# Fix symlink: we want to link to the versioned soname, not to the
|
||||||
|
# unversioned one that'd be put in -devel
|
||||||
|
pushd $RPM_BUILD_ROOT%{perl_vendorarch}/auto/Nix/Store
|
||||||
|
ln -sf %{_libdir}/nix/libNixStore.so.0 Store.so
|
||||||
|
popd
|
||||||
|
|
||||||
|
# Specify build users group
|
||||||
|
sed -i "s|#build-users-group =$|build-users-group = %{nixbld_group}|" \
|
||||||
|
$RPM_BUILD_ROOT%{_sysconfdir}/nix/nix.conf
|
||||||
|
# ... and delete the example configuration
|
||||||
|
rm $RPM_BUILD_ROOT%{_sysconfdir}/nix/nix.conf.example
|
||||||
|
|
||||||
|
# make per-user directories
|
||||||
|
for d in profiles gcroots;
|
||||||
|
do
|
||||||
|
mkdir $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
|
||||||
|
|
||||||
|
# Copy the byte-compiled mode file by hand
|
||||||
|
cp -p misc/emacs/nix-mode.elc $RPM_BUILD_ROOT%{_emacs_sitelispdir}/
|
||||||
|
|
||||||
|
# we ship this file in the base package
|
||||||
|
rm $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}-doc-%{version}/README
|
||||||
|
|
||||||
|
|
||||||
%check
|
%check
|
||||||
make check
|
make check
|
||||||
|
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
|
||||||
%pre
|
%pre
|
||||||
if test -n "%{nix_group_gid}"; then
|
getent group %{nixbld_group} >/dev/null || groupadd -r %{nixbld_group}
|
||||||
/usr/sbin/groupadd -g %{nix_group_gid} %{nix_group} || true
|
for i in $(seq 10);
|
||||||
fi
|
do
|
||||||
if test -n "%{nix_user_uid}"; then
|
getent passwd %{nixbld_user}$i >/dev/null || \
|
||||||
/usr/sbin/useradd -c "Nix" -u %{nix_user_uid} \
|
useradd -r -g %{nixbld_group} -G %{nixbld_group} -d /var/empty \
|
||||||
-s /sbin/nologin -r -d /var/empty %{nix_user} \
|
-s %{_sbindir}/nologin \
|
||||||
-g %{nix_group} || true
|
-c "Nix build user $i" %{nixbld_user}$i
|
||||||
fi
|
done
|
||||||
|
|
||||||
|
%post
|
||||||
|
chgrp %{nixbld_group} /nix/store
|
||||||
|
chmod 1775 /nix/store
|
||||||
|
|
||||||
%files
|
%files
|
||||||
#%defattr(-,root,root)
|
%doc COPYING AUTHORS README
|
||||||
%{_prefix}/bin
|
%{_bindir}/nix-*
|
||||||
%{_prefix}/lib
|
%dir %{_libdir}/nix
|
||||||
%{_prefix}/libexec
|
%{_libdir}/nix/*.so.*
|
||||||
%{_prefix}/include
|
%{perl_vendorarch}/*
|
||||||
%{_prefix}/share
|
%exclude %dir %{perl_vendorarch}/auto/
|
||||||
/etc/profile.d/nix.sh
|
%{_prefix}/libexec/*
|
||||||
/nix/var
|
%{_datadir}/emacs/site-lisp/nix-mode.el
|
||||||
/nix/store
|
%{_datadir}/nix
|
||||||
%config
|
%{_mandir}/man1/nix-*.1*
|
||||||
/etc/nix
|
%{_mandir}/man8/nix-*.8*
|
||||||
|
%config(noreplace) %{_sysconfdir}/profile.d/nix.sh
|
||||||
|
/nix
|
||||||
|
%dir %{_sysconfdir}/nix
|
||||||
|
%config(noreplace) %{_sysconfdir}/nix/nix.conf
|
||||||
|
|
||||||
|
%files devel
|
||||||
|
%{_includedir}/nix
|
||||||
|
%{_libdir}/nix/*.so
|
||||||
|
|
||||||
|
%files doc
|
||||||
|
%docdir %{_defaultdocdir}/%{name}-doc-%{version}
|
||||||
|
%{_defaultdocdir}/%{name}-doc-%{version}
|
||||||
|
|
||||||
|
%files -n emacs-%{name}
|
||||||
|
%{_emacs_sitelispdir}/*.elc
|
||||||
|
#{_emacs_sitestartdir}/*.el
|
||||||
|
|
||||||
|
%files -n emacs-%{name}-el
|
||||||
|
%{_emacs_sitelispdir}/*.el
|
||||||
|
|
Loading…
Reference in a new issue