Files
whc-nixos/pkgs/hp-uld-driver.nix
T
whc ad9bf8035e 整理 NixOS 配置:面向 i7-12700F + RTX 4060 的模块化桌面配置
从当前 /etc/nixos 拆出 common/plasma/中文/应用/打印模块,新增 NVIDIA 独显支持,并去掉原机硬件 UUID。
2026-09-19 15:50:30 +08:00

72 lines
1.8 KiB
Nix

# HP Unified Linux Driver for Laser MFP 13x / Laser 10x series (SPL)
{
lib,
stdenv,
fetchurl,
cups,
patchPpdFilesHook,
}:
let
arch = if stdenv.hostPlatform.system == "x86_64-linux" then "x86_64" else "i386";
libPath = lib.makeLibraryPath [ cups ] + ":$out/lib:${lib.getLib stdenv.cc.cc}/lib";
in
stdenv.mkDerivation {
pname = "hp-uld";
version = "1.00.39.12_00.15";
src = fetchurl {
url = "https://ftp.hp.com/pub/softlib/software13/printers/MFP170/uld-hp_V1.00.39.12_00.15.tar.gz";
sha256 = "sha256-zrube2El50BmNLucKpiwFHfR4R1mx8kEdGad6ZJ7yR0=";
};
sourceRoot = "uld";
nativeBuildInputs = [ patchPpdFilesHook ];
dontPatchELF = true;
dontStrip = true;
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/lib/cups/filter $out/lib $out/share/cups/model/hp
install -Dm755 ${arch}/rastertospl $out/lib/cups/filter/rastertospl
install -Dm755 ${arch}/pstosecps $out/lib/cups/filter/pstosecps
install -Dm755 ${arch}/libscmssc.so $out/lib/libscmssc.so
for exe in $out/lib/cups/filter/*; do
patchelf \
--set-rpath "${libPath}" \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
"$exe"
done
patchelf --set-rpath "${libPath}" $out/lib/libscmssc.so
cp -r noarch/share/ppd/*.ppd $out/share/cups/model/hp/
mkdir -p $out/share/cups/model/hp/cms
cp -r noarch/share/ppd/cms/* $out/share/cups/model/hp/cms/ || true
runHook postInstall
'';
ppdFileCommands = [
"pstosecps"
"rastertospl"
];
meta = {
description = "HP Unified Linux Driver (ULD) for Laser MFP 13x series";
homepage = "https://support.hp.com/";
license = lib.licenses.unfree;
platforms = [
"x86_64-linux"
"i686-linux"
];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
}