Custom fetch with auth

Hi, new-ish to NixOS here. Trying to write my first derivation (is that the right term? still don’t quite get it), it’s basically a standard autoPatchelfHook wrapper around a binary but to fetch the binary I need to log in first i.e.

curl -c cookiestore --request POST --data 'auth data' https://example.com/login
curl -b cookiestore --location https://example.com/actual_file.zip -o actual_file.zip

Is there any way to override something in fetchurl to do this? I haven’t been able to find anything like this.

I browsed around and found these custom fetchers… but since this is a one-off thing is there any simpler way to go about this?
I’d still like to make the auth data a parameter so I can make the nix file public.

Thanks

I ended up writing a custom builder script https://github.com/NixOS/nixpkgs/pull/91254/commits/54535dfe12cba8f80e065ec78b83e8891425c3aa

1 Like