diff --git a/pkgs/by-name/la/labelife-label-printer/package.nix b/pkgs/by-name/la/labelife-label-printer/package.nix index 13ab4a9603a2..6d4b1a8bc730 100644 --- a/pkgs/by-name/la/labelife-label-printer/package.nix +++ b/pkgs/by-name/la/labelife-label-printer/package.nix @@ -1,55 +1,61 @@ { lib, stdenv, - fetchzip, + fetchurl, + unzip, cups, autoPatchelfHook, - detox, }: +let + archAttrset = { + aarch64-linux = "aarch64"; + armv6l-linux = "arm"; + armv7l-linux = "armhf"; + i686-linux = "i386"; + x86_64-linux = "x86_64"; + }; +in stdenv.mkDerivation (finalAttrs: { pname = "labelife-label-printer"; - version = "2.0.0"; + version = "2.2.0.002"; arch = - { - aarch64-linux = "aarch64"; - armv7l-linux = "armhf"; - i686-linux = "i386"; - x86_64-linux = "x86_64"; - } - .${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); + archAttrset.${stdenv.hostPlatform.system} + or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); - src = fetchzip { + src = fetchurl { url = "https://oss.qu-in.ltd/Labelife/Label_Printer_Driver_Linux.zip"; - hash = "sha256-0ESZ0EqPh9Wz6ogQ6vTsAogujbn4zINtMh62sEpNRs4="; + hash = "sha256-yUrEV3pdTqiATZ1V9Ze0zTjsyA3b9i+Bbh1v0FzGeas="; }; nativeBuildInputs = [ + unzip autoPatchelfHook - detox ]; buildInputs = [ cups ]; unpackPhase = '' runHook preUnpack - tar -xzf ${finalAttrs.src}/LabelPrinter-${finalAttrs.version}.001.tar.gz --strip-components=1 + # Extract outer ZIP file + unzip -q ${finalAttrs.src} + + # Extract inner tar.gz with --strip-components=1 to remove the `LabelPrinter-${finalAttrs.version}/` prefix + tar -xzf Label_Printer_Driver_Linux.tar.gz --strip-components=1 runHook postUnpack ''; installPhase = '' runHook preInstall - # Remove spaces from PPD filenames - detox ppds # Install the CUPS filter with executable permissions install -Dm755 ./${finalAttrs.arch}/rastertolabeltspl $out/lib/cups/filter/rastertolabeltspl # Install all PPD files with read and write permissions for owner, and read for group and others for ppd in ./ppds/*.ppd; do - install -Dm644 $ppd $out/share/cups/model/label/$(basename $ppd) + install -Dm644 "$ppd" "$out/share/cups/model/label/$(basename "$ppd")" done runHook postInstall ''; @@ -71,12 +77,7 @@ stdenv.mkDerivation (finalAttrs: { - Aimo ''; maintainers = with lib.maintainers; [ daniel-fahey ]; - platforms = [ - "aarch64-linux" - "armv7l-linux" - "i686-linux" - "x86_64-linux" - ]; + platforms = lib.attrNames archAttrset; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; }; })