Hi I’m trying to create a package for Boomaga (GitHub - Boomaga/boomaga: Boomaga provides a virtual printer for CUPS. This can be used for print preview or for print booklets.). The package compiles well and it install two things, a cups backend for it and a corresponding gui app. The GUI app works well, but the cups_backend does not work, because it needs to write to /var/cache/boomaga and it fails as permission denied. How can I make this work?
This what I could come up with:
{ lib
, stdenv
, fetchFromGitHub
, cmake
, cups
, qtbase
, qttools
, wrapQtAppsHook
, pkg-config
, poppler
}:
stdenv.mkDerivation rec {
pname = "boomaga";
version = "3.0.0"; # Update this to the correct version
src = fetchFromGitHub {
owner = "Boomaga";
repo = "boomaga";
rev = "v${version}";
sha256 = "sha256-ThiyZ/fTwp+E639HavUv9WbRE+RxGbRwcPqXSuVWdaQ="; # Update with correct hash
};
nativeBuildInputs = [
cmake
wrapQtAppsHook
pkg-config
];
buildInputs = [
cups.dev
qtbase
qttools
poppler
];
cmakeFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DCUPS_PPD_DIR=${placeholder "out"}/share/cups/model/boomaga"
"-DCUPS_BACKEND_DIR=${placeholder "out"}/lib/cups/backend"
];
# postPatch = ''
# substituteInPlace src/backend/cups_backend/main.cpp \
# --replace "/var/cache/boomaga" "/var/cache/cups/boomaga"
# '';
meta = with lib; {
description = "Virtual printer for viewing and editing before printing";
homepage = "https://www.boomaga.org/";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ ]; # Add your name if you're maintaining this package
platforms = platforms.linux;
};
}
This is the virtual printer config I am using to create the virtual printer in my configuration:
{pkgs, ...}: let
boomaga = pkgs.libsForQt5.callPackage ./boomaga.nix {};
in {
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
environment.systemPackages = with pkgs; [
boomaga
];
hardware.printers = {
ensurePrinters = [
{
name = "Boomaga";
deviceUri = "boomaga:/";
model = "boomaga/boomaga.ppd";
description = "Boomaga Virtual Printer";
location = "Local Virtual Printer";
ppdOptions = {
# Add any specific PPD options here if needed
};
}
];
};
services.dbus.packages = [boomaga];
services.printing.drivers = with pkgs; [hplipWithPlugin boomaga];
}