nixpkgs/pkgs/by-name/cu/cups-idprt-mt890/package.nix
Artturin 5176f640ee cups-idprt-{barcode,mt888,mt890,sp900,tspl}: Fix missing attribute on aarch64-linux
`getAttr` has a slightly better performance but it's not possible to
throw with it so one would have to do `builtins.hasAttr` first which makes
that methods performance worse than string interpolation and `or throw`
2024-09-26 03:48:21 +03:00

57 lines
1.3 KiB
Nix

{
stdenvNoCC,
lib,
fetchurl,
autoPatchelfHook,
cups,
unzip,
}:
stdenvNoCC.mkDerivation {
pname = "cups-idprt-mt890";
version = "1.2.0";
src = fetchurl {
name = "idprt_mt890_printer_linux_driver.zip";
url = "https://www.idprt.com/prt_v2/files/down_file/id/320/fid/778.html"; # NOTE: This is NOT an HTML page, but a ZIP file
hash = "sha256-8yH+DSPRp4mjKOXw90TiGA4OzxJKHpBUMSLh3L2njw8=";
};
buildInputs = [ cups ];
nativeBuildInputs = [
autoPatchelfHook
unzip
];
installPhase =
let
arch =
{
x86_64-linux = "x64";
x86-linux = "x86";
}
."${stdenvNoCC.hostPlatform.system}"
or (throw "cups-idprt-mt890: No prebuilt filters for system: ${stdenvNoCC.hostPlatform.system}");
in
''
runHook preInstall
mkdir -p $out/share/cups/model $out/lib/cups/filter
cp -r filter/${arch}/. $out/lib/cups/filter
cp -r ppd/. $out/share/cups/model
rm $out/share/cups/model/*.ppd~
chmod +x $out/lib/cups/filter/*
runHook postInstall
'';
meta = {
description = "CUPS driver for the iDPRT MT890";
platforms = [
"x86_64-linux"
"x86-linux"
];
license = lib.licenses.unfree;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
maintainers = with lib.maintainers; [ pandapip1 ];
};
}