feat: add driver package for ticket printer

This commit is contained in:
Tim Schubert 2025-07-12 09:56:07 +02:00
parent f23cbdf69c
commit a414e85e51
No known key found for this signature in database
4 changed files with 79 additions and 3 deletions

View file

@ -128,6 +128,7 @@ in
enable = true; enable = true;
browsing = true; browsing = true;
drivers = with pkgs; [ drivers = with pkgs; [
config.dadada.pkgs.citizen-cups
hplip hplip
brlaser brlaser
brgenml1lpr brgenml1lpr

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { cfg, pkgs, ... }:
{ {
hardware = { hardware = {
printers = { printers = {
@ -29,7 +29,10 @@
services.printing = { services.printing = {
enable = true; enable = true;
drivers = [ pkgs.brlaser ]; drivers = [
pkgs.brlaser
pkgs.gutenprint
];
# Remove all state at the start of the service # Remove all state at the start of the service
stateless = true; stateless = true;
listenAddresses = [ "192.168.101.29:631" ]; listenAddresses = [ "192.168.101.29:631" ];

70
pkgs/citizen-cups.nix Normal file
View file

@ -0,0 +1,70 @@
{
cups,
fetchzip,
lib,
stdenv,
rpm,
}:
let
version = "1.2.8";
in
stdenv.mkDerivation {
inherit version;
name = "citizen-cups";
pname = "citizen-cups";
src = fetchzip {
url = "https://www.citizen-systems.com/resource/support/POS/Generic_Printer_Files/CUPS_Linux_Driver/CUPS_Linux_Driver.zip";
hash = "sha256-2ha24/7oS/rINKmYxyVryX66kkc6niCChxhw/2KOPSw=";
};
nativeBuildInputs = [
rpm
];
buildInputs = [
cups
];
postUnpack = ''
pushd source
ls -la
rpm2archive ctzpos-cups-1.2.8-0.src.rpm
tar xvf ctzpos-cups-1.2.8-0.src.rpm.tgz
tar xvf ctzpos-cups-1.2.8.tar.bz2
popd
'';
buildPhase = ''
runHook preBuild
pushd "ctzpos-cups-${version}";
gcc -Wl,-rpath,/usr/lib -Wall -fPIC -O2 -o rastertocbm1k rastertocbm1k.c -lcupsimage -lcups
gcc -Wl,-rpath,/usr/lib -Wall -fPIC -O2 -o rastertocds500 rastertocds500.c -lcupsimage -lcups
gcc -Wl,-rpath,/usr/lib -Wall -fPIC -O2 -o rastertocts2kl rastertocts2kl.c -lcupsimage -lcups
popd
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/lib/cups/filter
install -D -m 755 ./ctzpos-cups-${version}/rastertocbm1k $out/lib/cups/filter/rastertocbm1k
install -D -m 755 ./ctzpos-cups-${version}/rastertocds500 $out/lib/cups/filter/rastertocds500
install -D -m 755 ./ctzpos-cups-${version}/rastertocts2kl $out/lib/cups/filter/rastertocts2kl
mkdir -p $out/share/cups/model/citizen
install -D -m 644 ./ctzpos-cups-${version}/*.ppd $out/share/cups/model/citizen
runHook postInstall
'';
meta = with lib; {
description = "Citizen CUPS drivers and filters";
homepage = "https://www.citizen-systems.com";
#license = licenses.unfreeRedistributable;
maintainers = with maintainers; [ dadada ];
platforms = platforms.linux;
};
}

View file

@ -1 +1,3 @@
{ pkgs }: { } { pkgs }: {
citizen-cups = pkgs.callPackage ./citizen-cups.nix {};
}