From 60b7c9f8ca680b58b2f3db2a95dcea5da0869286 Mon Sep 17 00:00:00 2001 From: psentee <135014396+psentee@users.noreply.github.com> Date: Sun, 23 Mar 2025 17:06:02 +0100 Subject: [PATCH] hplip: fix plugin fetch (#391529) --- pkgs/by-name/hp/hplip/package.nix | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/pkgs/by-name/hp/hplip/package.nix b/pkgs/by-name/hp/hplip/package.nix index 024369818c48..619478ad6b00 100644 --- a/pkgs/by-name/hp/hplip/package.nix +++ b/pkgs/by-name/hp/hplip/package.nix @@ -43,7 +43,7 @@ let }; plugin = fetchurl { - url = "https://developers.hp.com/sites/default/files/${pname}-${version}-plugin.run"; + url = "https://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/${pname}-${version}-plugin.run"; hash = "sha256-Hzxr3SVmGoouGBU2VdbwbwKMHZwwjWnI7P13Z6LQxao="; }; @@ -79,9 +79,20 @@ assert || throw "HPLIP plugin not supported on ${stdenv.hostPlatform.system}"; python311Packages.buildPythonApplication { - inherit pname version src; + inherit pname version; format = "other"; + srcs = [ src ] ++ lib.optional withPlugin plugin; + + unpackCmd = lib.optionalString withPlugin '' + if ! [[ "$curSrc" =~ -plugin\.run$ ]]; then return 1; fi # fallback to regular unpackCmdHooks + + # Unpack plugin shar + sh "$curSrc" --noexec --keep + ''; + + sourceRoot = "${pname}-${version}"; + buildInputs = [ libjpeg @@ -247,8 +258,7 @@ python311Packages.buildPythonApplication { done '' + lib.optionalString withPlugin '' - sh ${plugin} --noexec --keep - cd plugin_tmp + pushd $NIX_BUILD_TOP/plugin_tmp cp plugin.spec $out/share/hplip/ @@ -284,6 +294,8 @@ python311Packages.buildPythonApplication { mkdir -p $out/var/lib/hp cp ${hplipState} $out/var/lib/hp/hplip.state + + popd ''; # The installed executables are just symlinks into $out/share/hplip,