Upwork overlay doesn't apply

I have following in my system config:

nixpkgs.overlays = [
  # upwork
  (final: prev: {
    upwork = prev.upwork.overrideAttrs (drv: {
      src = prev.fetchurl {
        url = "https://github.com/knarkzel/upwork/raw/master/upwork_5.6.10.24_amd64.deb";
        sha256 = "1pxcpgjw3jd29iz4avdh6jlhmrgmn2smlahbja7pi64mg7vhqm5g";
      };
    });
  })
];

environment.systemPackages = [ pkgs.upwork ];

Because Upwork has added bot detection to their download url, I use this instead. However, after running sudo nixos-rebuild switch, I get this error:

nixos ❯ sudo nixos-rebuild switch
error: builder for '/nix/store/8gd356cgs8qi4iv1ffcxwl99cafca5g4-upwork_5.6.10.13_amd64.deb.drv' failed with exit code 1;
       last 7 log lines:
       >
       > trying https://upwork-usw2-desktopapp.upwork.com/binaries/v5_6_10_13_3c485d1dd2af4f61/upwork_5.6.10.13_amd64.deb
       >   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
       >                                  Dload  Upload   Total   Spent    Left  Speed
       >   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
       > curl: (22) The requested URL returned error: 403
       > error: cannot download upwork_5.6.10.13_amd64.deb from any mirror
       For full logs, run 'nix log /nix/store/8gd356cgs8qi4iv1ffcxwl99cafca5g4-upwork_5.6.10.13_amd64.deb.drv'.
error: 1 dependencies of derivation '/nix/store/k2p8dlr2cir2dc6698qyvl7hhjzn6fpw-upwork-5.6.10.13.drv' failed to build
error: 1 dependencies of derivation '/nix/store/7gfdknmkj1q64j4pp7jjjpijzg7lvdbc-user-environment.drv' failed to build
error: 1 dependencies of derivation '/nix/store/rxrphwp7wm9xsrwc0x0csl64g41gk2jz-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/22f3y1bc253659jj47fhanpiyzf5m605-nixos-system-odd-22.05.20220917.f21492b.drv' failed to build 

I don’t know what’s going on with your overlay, but to get you going you can just copy the package modify it, and use that instead. He’s an example of how to deal with files that can’t be downloaded: erosanix/default.nix at 137b3563935e45c3112b1bd477c567adea7ac50e · emmanuelrosa/erosanix · GitHub

Once you’ve got it working, I’d be great if you can submit a PR to Nixpkgs to fix the package.

I have a working solution locally, but it would be great to have it working in my system config :smiley:

You can use your solution with your system config:

environment.systemPackages = [ 
    (pkgs.callPackage ./fixed-upwork.nix {})
 ];