btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / cu / cups-idprt-barcode / package.nix
bloba5e3a85b5a943e060c83a6c0c4ff71db6f4b01bb
2   stdenvNoCC,
3   lib,
4   fetchurl,
5   autoPatchelfHook,
6   cups,
7   unzip,
8 }:
10 stdenvNoCC.mkDerivation {
11   pname = "cups-idprt-barcode";
12   version = "1.2.1";
14   src = fetchurl {
15     name = "idprt_label_printer_linux_driver.zip"; # This is not the original name, but there was debate about whether rec or finalAttrs should be used, so I just renamed it
16     url = "https://www.idprt.com/prt_v2/files/down_file/id/265/fid/600.html"; # NOTE: This is NOT an HTML page, but a ZIP file
17     hash = "sha256-jp8DDaTmCgNrHCJSSz1K3xDcSB8dQm6i1pICaMrBFaQ=";
18   };
20   buildInputs = [ cups ];
21   nativeBuildInputs = [
22     autoPatchelfHook
23     unzip
24   ];
26   installPhase =
27     let
28       arch =
29         {
30           x86_64-linux = "x64";
31           x86-linux = "x86";
32         }
33         ."${stdenvNoCC.hostPlatform.system}"
34           or (throw "cups-idprt-barcode: No prebuilt filters for system: ${stdenvNoCC.hostPlatform.system}");
35     in
36     ''
37       runHook preInstall
38       mkdir -p $out/share/cups/model $out/lib/cups/filter
39       cp -r filter/${arch}/. $out/lib/cups/filter
40       cp -r ppd/. $out/share/cups/model
41       chmod +x $out/lib/cups/filter/*
42       runHook postInstall
43     '';
45   meta = {
46     description = "CUPS drivers for iDPRT barcode printers (iD2P, iD2X, iD4P, iD4S, iE2P, iE2X, iE4P, iE4S, iT4B, iT4E, iT4P, iT4S, iT4X, iX4E, iX4L, iX4P, iX4E, iX6P)";
47     platforms = [
48       "x86_64-linux"
49       "x86-linux"
50     ];
51     license = lib.licenses.unfree;
52     sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
53     maintainers = with lib.maintainers; [ pandapip1 ];
54   };