summary refs log tree commit diff
path: root/pkgs/misc/cups/drivers/splix/default.nix
blob: 1125e76971126e9d4f96ed6826108ecf942aaa03 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{ lib, stdenv, fetchsvn, fetchurl, cups, cups-filters, jbigkit, zlib }:

let

  color-profiles = stdenv.mkDerivation {
    name = "splix-color-profiles-20070625";

    src = fetchurl {
      url = "http://splix.ap2c.org/samsung_cms.tar.bz2";
      sha256 = "1156flics5m9m7a4hdmcc2nphbdyary6dfmbcrmsp9xb7ivsypdl";
    };

    phases = [ "unpackPhase" "installPhase" ];

    installPhase = ''
      mkdir -p $out/share/cups/profiles/samsung
      cp * $out/share/cups/profiles/samsung/
    '';
  };

in stdenv.mkDerivation rec {
  name = "splix-svn-${rev}";
  rev = "315";

  src = fetchsvn {
    # We build this from svn, because splix hasn't been in released in several years
    # although the community has been adding some new printer models.
    url = "svn://svn.code.sf.net/p/splix/code/splix";
    inherit rev;
    sha256 = "16wbm4xnz35ca3mw2iggf5f4jaxpyna718ia190ka6y4ah932jxl";
  };

  postPatch = ''
    mv -v *.ppd ppd/
    substituteInPlace src/pstoqpdl.cpp \
      --replace "RASTERDIR \"/\" RASTERTOQPDL" "\"$out/lib/cups/filter/rastertoqpdl\"" \
      --replace "RASTERDIR" "\"${cups-filters}/lib/cups/filter\"" \
  '';

  makeFlags = [
    "CUPSFILTER=$(out)/lib/cups/filter"
    "CUPSPPD=$(out)/share/cups/model"
    "CUPSPROFILE=${color-profiles}/share/cups/profiles"
  ];

  buildInputs = [ cups zlib jbigkit ];

  meta = with lib; {
    description = "CUPS drivers for SPL (Samsung Printer Language) printers";
    homepage = "http://splix.ap2c.org";
    license = licenses.gpl2;
    platforms = platforms.linux;
    maintainers = with maintainers; [ jfrankenau peti ];
  };
}