Refactor Docker-based packaging and delegate Nix installation to system hooks (see ChatGPT conversation: https://chatgpt.com/share/6936db94-ff30-800f-9b50-86a4b45c44bf)

This commit is contained in:
Kevin Veen-Birkenbach
2025-12-08 15:08:42 +01:00
parent ef23e14ae4
commit a5aaacc8d0
4 changed files with 153 additions and 102 deletions

View File

@@ -8,7 +8,12 @@ URL: https://github.com/kevinveenbirkenbach/package-manager
Source0: %{name}-%{version}.tar.gz
BuildArch: noarch
Requires: nix
# NOTE:
# Nix is a runtime requirement, but it is *not* declared here as a hard
# RPM dependency, because many distributions do not ship a "nix" RPM.
# Instead, Nix is installed and initialized by init-nix.sh, which is
# called in the %post scriptlet below.
%description
This package provides the `pkgmgr` command, which runs Kevin's package
@@ -16,14 +21,15 @@ manager via a local Nix flake:
nix run /usr/lib/package-manager#pkgmgr -- ...
Nix is the only runtime dependency and must be initialized on the
system to work correctly.
Nix is a runtime requirement and is installed/initialized by the
init-nix.sh helper during package installation if it is not yet
available on the system.
%prep
%setup -q
%build
# No build step required
# No build step required; we ship the project tree as-is.
:
%install
@@ -53,6 +59,7 @@ rm -rf \
%{buildroot}%{_libdir}/package-manager/.gitkeep || true
%post
# Initialize Nix (if needed) after installing the package-manager files.
if [ -x %{_libdir}/package-manager/init-nix.sh ]; then
%{_libdir}/package-manager/init-nix.sh || true
else