mkCoprSpec
mkCoprSpec generates a Fedora RPM .spec for packaging via COPR, Fedora’s community build service. harbor-rs only produces the spec — uploading or building it stays in CI (or a shell), where the COPR credentials live.
The defaults assume the “binary-shipping” workflow: a binary already built in Nix is bundled as the Source0 tarball, then installed to %{_bindir} by the generated %install section.
Parameters
pkgsnameversion— must not contain-(RPM forbids it inVersion:)release— defaults to1%{?dist}summarylicenseurlsources— list ofSource*lines; defaults toSource0: %{name}-%{version}.tar.gzbuildArch— e.g."x86_64"or"noarch"; omitted by defaultbuildRequiresrequiresdescription— defaults tosummaryprep,build,install,files— override the generated section bodiesdesktopFile,icon,appId— ifappId(reverse-DNS) is set, the default%installand%filesadd${appId}.desktopand a 256x256 hicolor iconchangelog— list of{ date; author; version; entries; }coprMakefile— whentrue, also emit a.copr/Makefilefor COPR’s custom-build SCM methodextraSections— appended raw before%changelog
Example
packages.copr-spec = (harbor-rs.lib.mkCoprSpec {
inherit pkgs;
name = "my-app";
version = "1.0.0";
summary = "My example application";
license = "MIT";
url = "https://example.com/my-app";
appId = "com.example.MyApp";
desktopFile = ''
[Desktop Entry]
Type=Application
Name=My App
Exec=my-app
Icon=com.example.MyApp
Categories=Utility;
'';
changelog = [
{
date = "Tue May 19 2026";
author = "Can <can@example.com>";
version = "1.0.0-1";
entries = ["Initial COPR release"];
}
];
}).specPath;
Workflow
nix build .#my-app
nix build .#copr-spec
tar czf my-app-1.0.0.tar.gz -C result/bin my-app
copr-cli build my-project ./result
For a pre-built binary, you usually want to disable COPR’s debuginfo extraction. Pass it through extraSections:
extraSections = "%global debug_package %{nil}";
If you’d rather have COPR drive the build itself from your git repo, set coprMakefile = true and commit the generated .copr/Makefile plus the .spec — then point a COPR “Custom” build at the repo.