Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hplip: fix plugin fetch #391529

Merged
merged 3 commits into from
Mar 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions pkgs/by-name/hp/hplip/package.nix
Original file line number Diff line number Diff line change
@@ -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,