%global nixbld_group nixbld # we patch out manual below (needs mdbook) %bcond docs 1 Name: nix Version: 2.12.1 Release: 0.2%{?dist} Summary: A purely functional package manager License: LGPL-2.1-or-later URL: https://github.com/NixOS/nix Source0: https://github.com/NixOS/nix/archive/%{version}/nix-%{version}.tar.gz Source1: nix.conf Source2: registry.json Source3: README.md Source4: nix.sysusers Source5: nix-filesystem.conf # building doc/manual should not require installation # https://github.com/NixOS/nix/issues/5140 # https://github.com/NixOS/nix/pull/5145 Patch0: 5145-backport.patch Patch1: nix-build-remote-symlink.patch Patch2: nix-manual-disable.patch BuildRequires: autoconf-archive BuildRequires: automake BuildRequires: bison BuildRequires: bzip2-devel BuildRequires: boost-devel BuildRequires: brotli-devel BuildRequires: chrpath BuildRequires: editline-devel BuildRequires: flex BuildRequires: gc-devel BuildRequires: gcc-c++ BuildRequires: gmock-devel BuildRequires: gtest-devel BuildRequires: jq BuildRequires: json-devel BuildRequires: libarchive-devel BuildRequires: libcurl-devel BuildRequires: libseccomp-devel BuildRequires: libsodium-devel BuildRequires: lowdown BuildRequires: lowdown-devel BuildRequires: make BuildRequires: openssl-devel BuildRequires: sqlite-devel BuildRequires: systemd-rpm-macros BuildRequires: xz-devel Requires: nix-core = %{version}-%{release} Requires: nix-system = %{version}-%{release} Recommends: (nix-daemon = %{version}-%{release} if systemd) Recommends: nix-legacy = %{version}-%{release} %description 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. See the README.fedora.md file for setup instructions. %package core Summary: Core nix tool %ifarch x86_64 aarch64 ppc64le #Recommends: busybox %endif %description core This package provides the core nix tool for modern flake-based commands. Most users should probably install nix-legacy as well, or the main nix package for a complete default setup. See the README.fedora.md file for setup instructions. %package daemon Summary: The nix daemon for multiuser mode BuildArch: noarch Requires: nix-core = %{version}-%{release} Requires: nix-system = %{version}-%{release} Requires: systemd %description daemon This package provides nix-daemon and associated files. %package devel Summary: Development files for nix Requires: nix%{?_isa} = %{version}-%{release} %description devel This package contains library and header files for developing applications that use nix. Note the API is considered unstable and upstream does not recommend its usage. %package filesystem Summary: Filesystem for nix BuildArch: noarch %description filesystem The package provides the /nix root directory for the nix package manager. %package legacy Summary: Nix classical commands BuildArch: noarch Requires: nix-core = %{version}-%{release} %description legacy This package provides the symlinks for the older nix-* commands. %package system Summary: Nix directories and sysusers setup BuildArch: noarch Requires: nix-filesystem = %{version}-%{release} %description system This package sets up the nix directories and sysusers. %prep %autosetup -p1 install -p -m 0644 %{SOURCE3} README.fedora.md %build %undefine _hardened_build ./bootstrap.sh %configure --localstatedir=/nix/var --disable-tests --disable-cpuid --with-system=%%{_arch}-linux make %{?_smp_mflags} %install make DESTDIR=%{buildroot} install find %{buildroot} -name '*.la' -exec rm -f {} ';' # nix config mkdir -p %{buildroot}/etc/nix # for older nix to avoid "error: system string 'linux' with 1 component is ambiguous" cat %{SOURCE1} | sed -e "s/@ARCH@/%{_arch}/" > %{buildroot}/etc/nix/nix.conf cp %{SOURCE2} %{buildroot}/etc/nix/ # Nix has multiuser and singleuser installation modes # https://nix.dev/manual/nix/stable/installation/nix-security.html mkdir -p %{buildroot}/nix/store mkdir -p %{buildroot}/nix/var/log/nix/drvs mkdir -p %{buildroot}/nix/var/nix install -p -D -m 0644 %{SOURCE4} %{buildroot}%{_sysusersdir}/nix.conf install -p -D -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/nix-filesystem.conf # fix permission of nix profile # (until this is fixed in the relevant Makefile) chmod -x %{buildroot}%{_sysconfdir}/profile.d/nix.sh rm %{buildroot}%{_mandir}/man1/nix3-manpages chrpath --delete %{buildroot}%{_bindir}/nix %{buildroot}%{_libdir}/libnixexpr.so %{buildroot}%{_libdir}/libnixmain.so %{buildroot}%{_libdir}/libnixstore.so %check LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}%{_bindir}/nix --help %post daemon %systemd_post nix-daemon.service %preun daemon %systemd_preun nix-daemon.service %postun daemon %systemd_postun_with_restart nix-daemon.service %pre filesystem %tmpfiles_create_package nix-filesystem %SOURCE5 %pre system %sysusers_create_package nix-system %SOURCE4 %files %files core %doc README.md README.fedora.md %{_bindir}/nix %{_libdir}/libnixcmd.so %{_libdir}/libnixexpr.so # %%{_libdir}/libnixexprc.so %{_libdir}/libnixfetchers.so # %%{_libdir}/libnixflake.so %{_libdir}/libnixmain.so %{_libdir}/libnixstore.so # %%{_libdir}/libnixstorec.so %{_libdir}/libnixutil.so # %%{_libdir}/libnixutilc.so %{_libexecdir}/nix %config(noreplace) %{_sysconfdir}/nix/nix.conf %config(noreplace) %{_sysconfdir}/nix/registry.json %config(noreplace) %{_sysconfdir}/profile.d/nix.sh %config(noreplace) %{_sysconfdir}/profile.d/nix.fish %{bash_completions_dir}/nix %{fish_completions_dir}/nix.fish %{zsh_completions_dir}/_nix %{zsh_completions_dir}/run-help-nix %if %{with docs} %{_mandir}/man1/nix.1* %{_mandir}/man1/nix3-*.1* %endif %files daemon %{_bindir}/nix-daemon %{_sysconfdir}/profile.d/nix-daemon.*sh %{_unitdir}/nix-daemon.* %{_tmpfilesdir}/nix-daemon.conf %ghost %dir /nix/var/nix/builds %ghost %dir /nix/var/nix/daemon-socket %ghost /nix/var/nix/daemon-socket/socket %if %{with docs} # somehow not installed #%%{_mandir}/man8/nix-daemon.8* %endif %files devel %{_includedir}/nix %{_libdir}/pkgconfig/*.pc %files filesystem # FHS Exception: https://pagure.io/fesco/issue/3473 %{_tmpfilesdir}/nix-filesystem.conf %ghost %dir /nix %ghost %dir /nix/var %ghost %dir /nix/var/log %ghost %dir /nix/var/log/nix %files legacy %{_bindir}/nix-build %{_bindir}/nix-channel %{_bindir}/nix-collect-garbage %{_bindir}/nix-copy-closure %{_bindir}/nix-env %{_bindir}/nix-hash %{_bindir}/nix-instantiate %{_bindir}/nix-prefetch-url %{_bindir}/nix-shell %{_bindir}/nix-store %if %{with docs} # not installed somehow # %%{_mandir}/man1/nix-*.1* %endif %files system %{_sysusersdir}/nix.conf %dir %attr(1775,root,%{nixbld_group}) /nix/store %dir %attr(775,root,%{nixbld_group}) /nix/var/log/nix/drvs %dir %attr(775,root,%{nixbld_group}) /nix/var/nix %ghost %dir /nix/var/nix/db %ghost /nix/var/nix/gc.lock %ghost %dir /nix/var/nix/gcroots %ghost %dir /nix/var/nix/gcroots/per-user %ghost %dir /nix/var/nix/gc-socket %ghost /nix/var/nix/gc-socket/socket %ghost %dir /nix/var/nix/profiles %ghost %dir /nix/var/nix/profiles/per-user %ghost %dir /nix/var/nix/temproots %changelog * Tue Oct 28 2025 Jens Petersen - 2.12.1-0.2 - update to 2.12.1 for epel9 - still experimental: legacy commands not working for nixpkgs and their manpages missing * Tue Jan 4 2022 Jens Petersen - 2.3.16-1 - update to 2.3.16 * Thu Aug 13 2020 Jens Petersen - 2.3.7-3 - drop nixbld group and users: only use single-user mode * Fri Aug 7 2020 Jens Petersen - 2.3.7-2 - upstream renamed nix-builder group to nixbld * Thu Aug 6 2020 Jens Petersen - 2.3.7-1 - update to 2.3.7 - drop erroring systemd units for now * Tue Sep 4 2018 Jens Petersen - 2.1-1 - update to 2.1 - https://nixos.org/nix/manual/#ssec-relnotes-2.1 * Wed Oct 5 2016 Jens Petersen - 1.11.4-1 - no longer subpackage the elisp - BR perl-devel * Mon Feb 15 2016 Jens Petersen - 1.11.2-2 - user/group fixes - create and own /nix/store and ghost socket * Sun Feb 14 2016 Jens Petersen - 1.11.2-1 - cleanup upstream spec file