Build failure: pantum-driver
Steps To Reproduce
Steps to reproduce the behavior:
NIXPKGS_ALLOW_UNFREE=1 nix shell --impure nixpkgs#pantum-driver
Same happens for environment.systemPackages and services.printing.drivers.
Build log
Additional context
I can download a zip archive from the link in sources and unpack it manually.
Notify maintainers
@deinferno
Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.
- system: `"x86_64-linux"`
- host os: `Linux 6.9.3, NixOS, 24.11 (Vicuña), 24.11.20240607.051f920`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.18.2`
- channels(root): `"nixos"`
- nixpkgs: `/nix/store/3dr5pyja36lvvrszhzffww1jwyrx6i09-source`
Add a :+1: reaction to issues you find important.
Looks like when I download it with curl I get a 3.9K file, but when I download it with my browser - it works fine.
Maybe it requires some additional headers now? This works:
curl --header 'Host: drivers.pantum.com' --user-agent 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0' --header 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/jxl,image/webp,*/*;q=0.8' --header 'Accept-Language: en-US,en;q=0.5' --cookie 'acw_tc=2ff62ca717182104526763710e9745960006f06f00e841ab72a6c5fc90; cdn_sec_tc=2ff62ca717182104526763710e9745960006f06f00e841ab72a6c5fc90; acw_sc__v2=6669cf9434f25a73c7dcefd2c5cf5d3623f968ab' --header 'Upgrade-Insecure-Requests: 1' --header 'Sec-Fetch-Dest: document' --header 'Sec-Fetch-Mode: navigate' --header 'Sec-Fetch-Site: cross-site' 'https://drivers.pantum.com/userfiles/files/download/drive/Pantum%20Ubuntu%20Driver%20V1_1_106.zip' --output 'Pantum Ubuntu Driver V1_1_106.zip'
changed download url again https://drivers.pantum.ru/userfiles/files/download/drive/RU%20driver20240403/pantum-r_1_0_9bb04-1astra1_amd64.zip
Is there a way to add the browser downloaded file to the nix store such that it is picked up during the build from the store instead of downloaded? nix-prefetch-url --unpack from a local HTTP server does not seem to work.
Not a proper solution, but I uploaded driver as release in a mockup github repository (https://github.com/jilinoleg/pantum-driver-fake-url) and made a copy of .nix file locally, changing the link in fetcher (but not the checksum).
It seems to build with this hack, though I am yet to fully rebuild my system to check if driver actually works after that.
It looks like we can follow pantum-driver AUR way of doing things by downloading from github release, it's breaking copyright of manufacturer by redistributing but it's should be more reliable that manufacturer's website.
As pointed out in previous comments it's possible to download archive by manipulating with headers and user agent of curl, but i am not sure if it's possible to apply those options to pkgs.fetchurl function.
I believe curlOpts can be used to pass the necessary options.
I tried progressively removing headers until the download fails and found that the acw_sc__v2 cookie is the only one that mattered. Some quick searching revealed that it is related to a web application firewall that attempts to block crawlers. More details here: https://github.com/WangYihang/acw-sc-v2-py
Given that fetchurl (and hence fetchzip) will not be able to pull off such a complex bypass mechanism the solution I've opted for is to point the src URL at the following .ru domain that does not do the checks. https://drivers.pantum.ru/userfiles/files/download/drive/2013/0619/Pantum%20Ubuntu%20Driver%20V1_1_106(1).zip
md5 and sha256 hashes match the browser downloaded versions. 0f4dd5486590cc1a0cd8b28bdfe8bc84 21f97310cda4aaa32a390599e44bbdd3a7446bce61f8d1519a847bcbb58f5fb4
Can someone confirm if this URL works for them?
Can someone confirm if this URL works for them?
I confirm.