{
  lib,
  stdenv,
  fetchsvn,
  fetchurl,
  cups,
  cups-filters,
  jbigkit,
  zlib,
}:
let
  color-profiles = stdenv.mkDerivation {
    pname = "splix-color-profiles";
    version = "0-unstable-2007-06-25";

    src = fetchurl {
      url = "https://web.archive.org/web/20170518031609if_/http://splix.ap2c.org/samsung_cms.tar.bz2";
      hash = "sha256-tF2vdzyrp6trZqu6ZnxWvi14rWCsNkjUqakWzSJ1poQ=";
    };

    installPhase = ''
      mkdir -p $out/share/cups/profiles/samsung
      cp * $out/share/cups/profiles/samsung/
    '';
  };
in
stdenv.mkDerivation (finalAttrs: {
  pname = "splix-svn";
  version = "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";
    rev = finalAttrs.version;
    hash = "sha256-tEsxElTEGzVBCiqicJT1tytJXHHvRcHrUKyMbzupi5s=";
  };

  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 = {
    description = "CUPS drivers for SPL (Samsung Printer Language) printers";
    homepage = "https://web.archive.org/web/20220729010458/http://splix.ap2c.org/";
    license = lib.licenses.gpl2Only;
    platforms = lib.platforms.linux;
    maintainers = [ ];
  };
})
