File nix.spec of Package nix

#
# spec file for package nix
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%global services nix-daemon.socket nix-daemon.service

%bcond_with    meson

Name:           nix
Version:        2.24.11
Release:        0
Summary:        The purely functional package manager
License:        LGPL-2.1-only
URL:            https://nixos.org/
Source:         https://github.com/NixOS/nix/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        nix.conf
Source2:        sysusers.conf
Source9:        series
Patch1:         0001-port-option-to-disable-functional-tests-to-meson.patch
Patch2:         0003-default-to-readline.patch
Patch3:         0002-handle-lowdown-1.4-API-change.patch
BuildRequires:  autoconf
BuildRequires:  autoconf-archive
BuildRequires:  automake
BuildRequires:  bison
BuildRequires:  boost-devel
BuildRequires:  doxygen
BuildRequires:  fish
BuildRequires:  flex
BuildRequires:  gcc-c++
BuildRequires:  jq
BuildRequires:  libboost_container-devel
BuildRequires:  libboost_context-devel
BuildRequires:  libboost_coroutine-devel
BuildRequires:  libtool
BuildRequires:  lowdown
BuildRequires:  lsof
BuildRequires:  curl
BuildRequires:  mdbook
BuildRequires:  meson
BuildRequires:  perl-DBD-SQLite
BuildRequires:  pkgconfig
BuildRequires:  sysuser-shadow
BuildRequires:  sysuser-tools
BuildRequires:  zsh
BuildRequires:  cmake(toml11)
BuildRequires:  pkgconfig(bash-completion)
BuildRequires:  pkgconfig(bdw-gc)
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(libarchive)
BuildRequires:  pkgconfig(libbrotlienc)
BuildRequires:  pkgconfig(libcpuid)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(libgit2)
BuildRequires:  pkgconfig(libseccomp) >= 2.5.5
BuildRequires:  pkgconfig(libsodium)
BuildRequires:  pkgconfig(lowdown)
BuildRequires:  pkgconfig(nlohmann_json)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(readline)
BuildRequires:  pkgconfig(sqlite3)
BuildRequires:  pkgconfig(systemd)
Requires:       jq
%{?systemd_ordering}
%{?sysusers_requires}

%description
Nix is a powerful package manager for Linux and other Unix systems that makes package management reliable and reproducible. Please refer to the Nix manual for more details.

%package devel
Summary:        The purely functional package manager
Requires:       %{name} = %{version}

%description devel
Nix is a powerful package manager for Linux and other Unix systems that makes package management reliable and reproducible. Please refer to the Nix manual for more details.

This package holds the development files for nix.

%prep
%autosetup -p1

%build
echo %{version} > .version
%if %{without meson}

export ACLOCAL_AMFLAGS="-I."
aclocal
# to get the config.h.in
autoreconf -fi ||:
%configure --with-readline-flavor=readline --disable-unit-tests --disable-functional-tests --enable-year2038 --disable-doc-gen --libdir=%{_libdir}/nix/
%make_build

%else

%meson -Dfunctional-tests=disabled --libdir=%{_libdir}/nix/
%meson_build

%endif
%sysusers_generate_pre %{SOURCE2} %{name} %{name}.conf

%install
%if %{without meson}

%make_install V=1
mv %{buildroot}%{_libdir}/nix/pkgconfig/ %{buildroot}%{_libdir}

%else

%meson_install

%endif

install -D -m 0644 -t %{buildroot}%{_sysconfdir}/%{name}/ %{SOURCE1}
install -D -m 0644 %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}.conf

%pre -f %{name}.pre
%service_add_pre %{services}

%preun
%service_del_preun %{services}

%post
%tmpfiles_create %{_tmpfilesdir}/nix-daemon.conf
%service_add_post %{services}

%postun
%service_del_postun %{services}

%files
%license COPYING
%doc *.md
%config(noreplace) %{_sysconfdir}/nix/
%config %{_sysconfdir}/init
%config %{_sysconfdir}/profile.d/nix-daemon.fish
%config %{_sysconfdir}/profile.d/nix-daemon.sh
%config %{_sysconfdir}/profile.d/nix.fish
%config %{_sysconfdir}/profile.d/nix.sh
%{_bindir}/nix
%{_bindir}/nix-build
%{_bindir}/nix-channel
%{_bindir}/nix-collect-garbage
%{_bindir}/nix-copy-closure
%{_bindir}/nix-daemon
%{_bindir}/nix-env
%{_bindir}/nix-hash
%{_bindir}/nix-instantiate
%{_bindir}/nix-prefetch-url
%{_bindir}/nix-shell
%{_bindir}/nix-store
%{_unitdir}/nix-daemon.service
%{_unitdir}/nix-daemon.socket
%{_tmpfilesdir}/nix-daemon.conf
%{_sysusersdir}/%{name}.conf
%dir %{_libdir}/nix/
%{_libdir}/nix/libnixcmd.so
%{_libdir}/nix/libnixexpr.so
%{_libdir}/nix/libnixexprc.so
%{_libdir}/nix/libnixfetchers.so
%{_libdir}/nix/libnixmain.so
%{_libdir}/nix/libnixstore.so
%{_libdir}/nix/libnixstorec.so
%{_libdir}/nix/libnixutil.so
%{_libdir}/nix/libnixutilc.so
%{_libdir}/nix/libnixflake.so
%{_libexecdir}/nix/
%{_datadir}/bash-completion/completions/nix
%{_datadir}/fish/vendor_completions.d/nix.fish
%{_datadir}/zsh/site-functions/_nix
%{_datadir}/zsh/site-functions/run-help-nix
%ghost %dir %attr(755,root,root) %{_localstatedir}/nix
%ghost %dir %attr(755,root,root) %{_localstatedir}/nix/daemon-socket

%files devel
%{_includedir}/nix/
%{_libdir}/pkgconfig/nix*

%changelog
openSUSE Build Service is sponsored by