Can't install VSCode due to bad URL

Hi! I am trying to install vscode through home-manager. On attempting switch, I get this error:

trying https://vscode-update.azurewebsites.net/1.45.0/linux-x64/stable
  % 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: 404 Not Found
error: cannot download VSCode_1.45.0_linux-x64.tar.gz from any mirror

Indeed, the URL it’s trying does not work. However, the URL I see on nixpkgs master does work.

The wrong URL appears in both my nixpkgs channel (nixpkgs-21.05pre275813.c5147860e23) and my nixos channel (nixos-20.03.3325.462c6fe4b11).

Three questions:

  1. Why are the VSCode fetch URLs wrong in my channels?
  2. What can I do to fix it in the immediate term? (I assume via something like an overlay?)
  3. What can I do to fix it in the longer term? (Send a PR with the good URL?)

Thanks!

  1. They are outdated and for some reason got purged by upstream.
  2. Use VSCode from master
  3. Wait for the changes to propagate to your channel. It will eventually land in unstable. Not sure if there is a backport into 20.09.

Thanks for the quick response!

I’ve never fully understood how to do this. Do I clone nixpkgs locally and set up a channel that points to it? Could you point me to documentation or an example of how to do this? Thanks!

I figured out one way to make it work. I am using niv with home-manager, which lets me pin a package set. The command

niv add nixos/nixpkgs -n nixpkgs-2021-03-30 -r 528fff9a5e8a250a29da51f624a13c1dbbd1382b

adds the right dependency (latest master on nixpkgs as of today), and then in my home.nix, something like

{ config, pkgs, ... }:

let
  sources = import ./nix/sources.nix;
  pkgs-2021-03-30 = import sources.nixpkgs-2021-03-30 {};
in {
  home.packages = [
    pkgs-2021-03-30.vscode
  ];
}

works! Thanks for the pointers!