commit e633ef5a601573933f350c8c01d9b1d10eb63fe5 Author: brian Date: Thu Aug 20 13:48:40 2026 -0400 print driver for jadens thermal label printer diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..426f727 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Nix build artefacts +result +result-* \ No newline at end of file diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..078999b --- /dev/null +++ b/default.nix @@ -0,0 +1,3 @@ +{ pkgs ? import { } }: + +pkgs.callPackage ./package.nix { } \ No newline at end of file diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..e9f7e83 --- /dev/null +++ b/package.nix @@ -0,0 +1,61 @@ +{ lib +, stdenv +, fetchurl +, dpkg +, autoPatchelfHook +, cups +}: + +stdenv.mkDerivation rec { + pname = "rollo-cups-driver"; + version = "1.8.4-1"; + + src = fetchurl { + url = "https://rollo-main.b-cdn.net/driver-dl/linux/rollo-cups-driver_${version}_amd64.deb"; + # Rollo's CDN gates the download on a Referer header, so we have to pass + # it through fetchurl's underlying curl call. + curlOptsList = [ "-H" "Referer: https://www.rollo.com/driver-linux/" ]; + hash = "sha256-01SKxC5qPdfpMqsCR6UuogmvbrYwF7BI+C1ptURfNko="; # replace after first build, see notes below + }; + + nativeBuildInputs = [ dpkg autoPatchelfHook ]; + buildInputs = [ stdenv.cc.cc.lib cups ]; + + unpackPhase = '' + runHook preUnpack + dpkg-deb -x $src debroot + runHook postUnpack + ''; + + dontBuild = true; + + installPhase = '' + runHook preInstall + + mkdir -p $out/lib/cups/filter + mkdir -p $out/share/cups/model + + # Layout inside the .deb has moved around between Rollo releases, so + # grab anything that looks like the filter binary or a PPD rather than + # hardcoding one path. + find debroot -type f \( -iname 'rastertorollo*' -o -iname 'rastertolabel*' \) \ + -exec install -m755 {} $out/lib/cups/filter/ \; + + find debroot -type f -iname '*.ppd' \ + -exec install -m644 {} $out/share/cups/model/ \; + + runHook postInstall + ''; + + # autoPatchelfHook rewrites the ELF interpreter/rpath to point at + # $buildInputs in the Nix store instead of /lib64/ld-linux-x86-64.so.2 + # and the FHS lib paths the binary was linked against. + + meta = with lib; { + description = "Rollo/Beeprt/JADENS proprietary CUPS raster filter for TSPL thermal label printers"; + homepage = "https://www.rollo.com/driver-linux/"; + license = licenses.unfree; + platforms = [ "x86_64-linux" ]; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + }; +} \ No newline at end of file