How to install latest vscode-insiders

I am new to nix and nixos. I have my system configured using the repo
nixflk.

I am trying to install the latest version of vscode with overlays. The file overlays/vscode.nix looks like this

final: prev: {
  # set default cursor theme when installed
  isInsiders = true;
}

this raises error

Also I don’t know how to use that latest version available. As of now the unpkgs version is 1.46.0 while the latest version from the vscode site is built daily.

Is this the correct approach or should I clone the entire the nixpkgs and update the derivation?

Could anyone help me understand these?

1 Like

I had this monster of a expression among my overrides:

vscode-insiders= #(final.vscode.override { isInsiders = true;executableName="code"; }).overrideAttrs
        (final.callPackage "${nixpkgs}/pkgs/applications/editors/vscode/generic.nix"
        (rec {
          src=builtins.fetchtarball"https://update.code.visualstudio.com/latest/linux-x64/insider";
          pname="vscode-insiders";
          executableName="code-insiders";
          longName="Visual Studio Code - Insiders";
          shortName="Code - Insiders";
          sourceRoot="";
          version = "latest";
          #plat = "linux-x64";
          #archive_fmt = "tar.gz";
          meta={};
        })).overrideAttrs(old:{
        
          #backport "https://github.com/NixOS/nixpkgs/pull/79889/files"
          preFixup = with final; ''
            gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : ${
              lib.makeLibraryPath [ systemd fontconfig libdbusmenu-gtk3 ]
            })
          '';
      });

however it could be hit or miss as the tarball inside could get either one with the ‘code’ executable or one with ‘code-insiders’,so I didn’t use it anymore

1 Like

Thanks, this looks promising. I will start with this.

I ended up with. This is places inside the nixflk repos → overlays/vscode.nix

final: prev:
let
  vscode-insider = prev.vscode.override {
    isInsiders = true;
  };
in
{
  vscode = vscode-insider.overrideAttrs (oldAttrs: rec {
    src = (builtins.fetchTarball {
      url = "https://update.code.visualstudio.com/latest/linux-x64/insider";
      sha256 = "03nmmcr8canxnhxpsd2d5rfqi6d7njab4c3bpcqmfi9xbk3scx1a";
    });
    version = "latest";
  });
}
2 Likes

:woman_zombie: @jnoortheen’s solution above still works in 2022, and this is the only place it’s written down. Somebody should add it to Visual Studio Code - NixOS Wiki at the least.

I uncomment this (identical to above just inline) block in my home-manager config when I need to test insider:

    programs.vscode.package = (pkgs.vscode.override{ isInsiders = true; }).overrideAttrs (oldAttrs: rec {
      src = (builtins.fetchTarball {
        url = "https://update.code.visualstudio.com/latest/linux-x64/insider";
        sha256 = "1dajhfsdr55mfnj12clf5apy1d4swr71d3rfwlq2hvvmpxvxsa59";
      });
      version = "latest";
    });

The first run will fail and tell you the current value for sha256.

2 Likes

Added Visual Studio Code - NixOS Wiki

3 Likes

If anybody tries to acquire a stable binary of code-insider, you might check the flake: GitHub - iosmanthus/code-insiders-flake. This repo creates a github action to sync the code-insider every day and produce a stable manifest.